]> git.donarmstrong.com Git - kiibohd-controller.git/commitdiff
Add Clear CLI function
authorRowan Decker <Smasher816@gmail.com>
Thu, 2 Apr 2015 06:38:26 +0000 (23:38 -0700)
committerRowan Decker <Smasher816@gmail.com>
Thu, 2 Apr 2015 06:42:38 +0000 (23:42 -0700)
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

Debug/cli/cli.c
Debug/cli/cli.h

index e91046903cd32f6d2bda1d669bef67a3e46f941a..bcb89fced4ccd7e00601cb3f513c2c2a4a6d6d15 100644 (file)
@@ -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( restart,  "Sends a software restart, should be similar to powerin
 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 @@ inline void CLI_tabCompletion()
 
 // ----- 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
index 27c975e4b86a1678698cd7c6a8e5878212e949f9..d18cae6f2a03b341bfa1395d14a417ca398b267e 100644 (file)
@@ -108,6 +108,7 @@ void CLI_tabCompletion();
 // 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 );