Modern terminals often have a banner that can display useful information. For example, it might show which user is currently logged in or which directory is active in the file system.
Unfortunately, Shellminator isn't quite advanced enough to manage users and file systems just yet. However, the good news is that you have the option to modify the banner text anytime during runtime to suit your needs. All you need to do is call the setBannerText
or setBannerPathText
functions with the desired text.
Live Demo
Whole Code
void pathCallback(
char* buffer,
int bufferSize,
Shellminator* parent ){
if( buffer[ 0 ] == '\0' ){
parent -> channel -> println();
parent -> channel -> print( "The path input is empty." );
parent -> input( pathBuffer, pathBufferSize, "Please enter the path: ", pathCallback );
return;
}
buffer[ pathBufferSize - 1 ] = '\0';
shell.clear();
parent -> setBannerText( nameBuffer );
parent -> setBannerPathText( pathBuffer );
}
void nameCallback(
char* buffer,
int bufferSize,
Shellminator* parent ){
if( buffer[ 0 ] == '\0' ){
parent -> channel -> println();
parent -> channel -> print( "The name input is empty." );
parent -> input( nameBuffer, nameBufferSize, "Please enter your name: ", nameCallback );
return;
}
buffer[ nameBufferSize - 1 ] = '\0';
parent -> input( pathBuffer, pathBufferSize, "Please enter the path: ", pathCallback );
}
void setup(){
Serial.begin(115200);
shell.clear();
shell.begin( "default" );
shell.input( nameBuffer, nameBufferSize, "Please enter your name: ", nameCallback );
}
void loop(){
shell.update();
}
#define SHELLMINATOR_BANNER_PATH_LEN
#define SHELLMINATOR_BANNER_LEN