Browse Source

Fix 'test' problem with prefixed PARAM.

git-svn-id: https://klish.googlecode.com/svn/trunk@250 0eaa4687-2ee9-07dd-09d9-bcdd2d2dd5fb
Serj Kalichev 14 years ago
parent
commit
34ce492654
2 changed files with 13 additions and 9 deletions
  1. 9 8
      clish/param/param_dump.c
  2. 4 1
      clish/shell/shell_tinyxml_read.cpp

+ 9 - 8
clish/param/param_dump.c

@@ -12,11 +12,11 @@ void clish_param_dump(const clish_param_t * this)
 	lub_dump_printf("param(%p)\n", this);
 	lub_dump_printf("param(%p)\n", this);
 
 
 	lub_dump_indent();
 	lub_dump_indent();
-	lub_dump_printf("name   : %s\n", this->name);
-	lub_dump_printf("text   : %s\n", this->text);
-	lub_dump_printf("value  : %s\n", this->value);
-	lub_dump_printf("ptype  : %s\n", clish_ptype__get_name(this->ptype));
-	lub_dump_printf("default: %s\n",
+	lub_dump_printf("name     : %s\n", this->name);
+	lub_dump_printf("text     : %s\n", this->text);
+	lub_dump_printf("value    : %s\n", this->value);
+	lub_dump_printf("ptype    : %s\n", clish_ptype__get_name(this->ptype));
+	lub_dump_printf("default  : %s\n",
 			this->defval ? this->defval : "(null)");
 			this->defval ? this->defval : "(null)");
 	switch (this->mode) {
 	switch (this->mode) {
 	case CLISH_PARAM_COMMON:
 	case CLISH_PARAM_COMMON:
@@ -32,12 +32,13 @@ void clish_param_dump(const clish_param_t * this)
 		mode = "Unknown";
 		mode = "Unknown";
 		break;
 		break;
 	}
 	}
-	lub_dump_printf("mode   : %s\n", mode);
-	lub_dump_printf("paramc : %d\n", clish_paramv__get_count(this->paramv));
+	lub_dump_printf("mode     : %s\n", mode);
+	lub_dump_printf("paramc   : %d\n", clish_paramv__get_count(this->paramv));
 	lub_dump_printf("optional : %s\n",
 	lub_dump_printf("optional : %s\n",
 			this->optional ? "true" : "false");
 			this->optional ? "true" : "false");
-	lub_dump_printf("hidden : %s\n",
+	lub_dump_printf("hidden   : %s\n",
 			this->hidden ? "true" : "false");
 			this->hidden ? "true" : "false");
+	lub_dump_printf("test     : %s\n", this->test);
 
 
 	/* Get each parameter to dump their details */
 	/* Get each parameter to dump their details */
 	for (i = 0; i < clish_paramv__get_count(this->paramv); i++) {
 	for (i = 0; i < clish_paramv__get_count(this->paramv); i++) {

+ 4 - 1
clish/shell/shell_tinyxml_read.cpp

@@ -368,6 +368,9 @@ process_param(clish_shell_t * shell, TiXmlElement * element, void *parent)
 					      CLISH_PARAM_SUBCOMMAND);
 					      CLISH_PARAM_SUBCOMMAND);
 			clish_param__set_optional(opt_param, BOOL_TRUE);
 			clish_param__set_optional(opt_param, BOOL_TRUE);
 
 
+			if (NULL != test)
+				clish_param__set_test(opt_param, test);
+
 			if (cmd)
 			if (cmd)
 				// add the parameter to the command
 				// add the parameter to the command
 				clish_command_insert_param(cmd, opt_param);
 				clish_command_insert_param(cmd, opt_param);
@@ -414,7 +417,7 @@ process_param(clish_shell_t * shell, TiXmlElement * element, void *parent)
 				CLISH_PARAM_SUBCOMMAND);
 				CLISH_PARAM_SUBCOMMAND);
 		}
 		}
 
 
-		if (NULL != test)
+		if ((NULL != test) && (NULL == prefix))
 			clish_param__set_test(param, test);
 			clish_param__set_test(param, test);
 
 
 		if (cmd)
 		if (cmd)