changeset 112:0cb43cb8f683

Adding dictionary titles.
author Jacob Alexander <haata@kiibohd.com>
date Fri, 24 Jan 2014 01:56:44 -0800
parents 59391aa888aa
children aaab1dfb0ca5
files Debug/cli/cli.c Debug/cli/cli.h
diffstat 2 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/Debug/cli/cli.c	Fri Jan 24 01:42:43 2014 -0800
+++ b/Debug/cli/cli.c	Fri Jan 24 01:56:44 2014 -0800
@@ -35,6 +35,7 @@
 // ----- Variables -----
 
 // Basic command dictionary
+char*       basicCLIDictName = "General Commands";
 CLIDictItem basicCLIDict[] = {
 	{ "cliDebug", "Enables/Disables hex output of the most recent cli input.", cliFunc_cliDebug },
 	{ "help",     "You're looking at it :P", cliFunc_help },
@@ -67,7 +68,7 @@
 
 	// Register first dictionary
 	CLIDictionariesUsed = 0;
-	registerDictionary_cli( basicCLIDict );
+	registerDictionary_cli( basicCLIDict, basicCLIDictName );
 
 	// Initialize main LED
 	init_errorLED();
@@ -258,7 +259,7 @@
 }
 
 // Registers a command dictionary with the CLI
-inline void registerDictionary_cli( CLIDictItem *cmdDict )
+inline void registerDictionary_cli( CLIDictItem *cmdDict, char* dictName )
 {
 	// Make sure this max limit of dictionaries hasn't been reached
 	if ( CLIDictionariesUsed >= CLIMaxDictionaries )
@@ -268,6 +269,7 @@
 	}
 
 	// Add dictionary
+	CLIDictNames[CLIDictionariesUsed] = dictName;
 	CLIDict[CLIDictionariesUsed++] = cmdDict;
 }
 
@@ -298,9 +300,8 @@
 	//  (no alphabetical here, too much processing/memory to sort...)
 	for ( uint8_t dict = 0; dict < CLIDictionariesUsed; dict++ )
 	{
-		print( NL "\033[1;32mCOMMAND SET\033[0m " );
-		printInt8( dict + 1 );
-		print( NL );
+		// Print the name of each dictionary as a title
+		dPrintStrsNL( NL, "\033[1;32m", CLIDictNames[dict], "\033[0m" );
 
 		// Parse each cmd/description until a null command entry is found
 		for ( uint8_t cmd = 0; CLIDict[dict][cmd].name != 0; cmd++ )
--- a/Debug/cli/cli.h	Fri Jan 24 01:42:43 2014 -0800
+++ b/Debug/cli/cli.h	Fri Jan 24 01:56:44 2014 -0800
@@ -55,8 +55,9 @@
 uint8_t CLILineBufferCurrent;
 
 // Main command dictionary
-CLIDictItem *CLIDict[CLIMaxDictionaries];
-uint8_t CLIDictionariesUsed;
+CLIDictItem *CLIDict     [CLIMaxDictionaries];
+char*        CLIDictNames[CLIMaxDictionaries];
+uint8_t      CLIDictionariesUsed;
 
 uint8_t CLILEDState;
 uint8_t CLIHexDebugMode;
@@ -67,7 +68,7 @@
 
 void init_cli();
 void process_cli();
-void registerDictionary_cli( CLIDictItem *cmdDict );
+void registerDictionary_cli( CLIDictItem *cmdDict, char* dictName );
 void argumentIsolation_cli( char* string, char** first, char** second );
 
 void commandLookup_cli();