Просмотр исходного кода

Add Clear CLI function

Sometimes it would be nice to clear the screen if it has a lot of
information (ex: when in debug information). Some terminals support ^L
to clear screen, but not all (iTerm2 on my mac does not), so I think
this is worthwhile to add.

Edit: Forgot cli.h
bringup
Rowan Decker 9 лет назад
Родитель
Сommit
a3d854fde3
2 измененных файлов: 8 добавлений и 0 удалений
  1. 7
    0
      Debug/cli/cli.c
  2. 1
    0
      Debug/cli/cli.h

+ 7
- 0
Debug/cli/cli.c Просмотреть файл

// ----- Variables ----- // ----- Variables -----


// Basic command dictionary // Basic command dictionary
CLIDict_Entry( clear, "Clear the screen.");
CLIDict_Entry( cliDebug, "Enables/Disables hex output of the most recent cli input." ); CLIDict_Entry( cliDebug, "Enables/Disables hex output of the most recent cli input." );
CLIDict_Entry( help, "You're looking at it :P" ); CLIDict_Entry( help, "You're looking at it :P" );
CLIDict_Entry( led, "Enables/Disables indicator LED. Try a couple times just in case the LED is in an odd state.\r\n\t\t\033[33mWarning\033[0m: May adversely affect some modules..." ); CLIDict_Entry( led, "Enables/Disables indicator LED. Try a couple times just in case the LED is in an odd state.\r\n\t\t\033[33mWarning\033[0m: May adversely affect some modules..." );
CLIDict_Entry( version, "Version information about this firmware." ); CLIDict_Entry( version, "Version information about this firmware." );


CLIDict_Def( basicCLIDict, "General Commands" ) = { CLIDict_Def( basicCLIDict, "General Commands" ) = {
CLIDict_Item( clear ),
CLIDict_Item( cliDebug ), CLIDict_Item( cliDebug ),
CLIDict_Item( help ), CLIDict_Item( help ),
CLIDict_Item( led ), CLIDict_Item( led ),


// ----- CLI Command Functions ----- // ----- CLI Command Functions -----


void cliFunc_clear( char* args)
{
print("\033[2J\033[H\r"); // Erases the whole screen
}

void cliFunc_cliDebug( char* args ) void cliFunc_cliDebug( char* args )
{ {
// Toggle Hex Debug Mode // Toggle Hex Debug Mode

+ 1
- 0
Debug/cli/cli.h Просмотреть файл

// CLI Command Functions // CLI Command Functions
void cliFunc_arch ( char* args ); void cliFunc_arch ( char* args );
void cliFunc_chip ( char* args ); void cliFunc_chip ( char* args );
void cliFunc_clear ( char* args );
void cliFunc_cliDebug( char* args ); void cliFunc_cliDebug( char* args );
void cliFunc_device ( char* args ); void cliFunc_device ( char* args );
void cliFunc_help ( char* args ); void cliFunc_help ( char* args );