Mercurial > louis > kiibohd-controller
changeset 316:a0ad3a172269
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
author | Rowan Decker <Smasher816@gmail.com> |
---|---|
date | Wed, 01 Apr 2015 23:38:26 -0700 |
parents | a2df35fa4f0b |
children | 7d21e5b97be4 217e7bd8a0a4 |
files | Debug/cli/cli.c Debug/cli/cli.h |
diffstat | 2 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/Debug/cli/cli.c Sun Mar 15 21:37:57 2015 -0700 +++ b/Debug/cli/cli.c Wed Apr 01 23:38:26 2015 -0700 @@ -35,6 +35,7 @@ // ----- Variables ----- // Basic command dictionary +CLIDict_Entry( clear, "Clear the screen."); CLIDict_Entry( cliDebug, "Enables/Disables hex output of the most recent cli input." ); 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..." ); @@ -44,6 +45,7 @@ CLIDict_Entry( version, "Version information about this firmware." ); CLIDict_Def( basicCLIDict, "General Commands" ) = { + CLIDict_Item( clear ), CLIDict_Item( cliDebug ), CLIDict_Item( help ), CLIDict_Item( led ), @@ -350,6 +352,11 @@ // ----- CLI Command Functions ----- +void cliFunc_clear( char* args) +{ + print("\033[2J\033[H\r"); // Erases the whole screen +} + void cliFunc_cliDebug( char* args ) { // Toggle Hex Debug Mode
--- a/Debug/cli/cli.h Sun Mar 15 21:37:57 2015 -0700 +++ b/Debug/cli/cli.h Wed Apr 01 23:38:26 2015 -0700 @@ -108,6 +108,7 @@ // CLI Command Functions void cliFunc_arch ( char* args ); void cliFunc_chip ( char* args ); +void cliFunc_clear ( char* args ); void cliFunc_cliDebug( char* args ); void cliFunc_device ( char* args ); void cliFunc_help ( char* args );