소스 검색

Unfinished <cr> in help messages

git-svn-id: https://klish.googlecode.com/svn/trunk@416 0eaa4687-2ee9-07dd-09d9-bcdd2d2dd5fb
Serj Kalichev 13 년 전
부모
커밋
5f72e5726c
3개의 변경된 파일12개의 추가작업 그리고 3개의 파일을 삭제
  1. 9 1
      clish/command/command.c
  2. 1 1
      clish/pargv/pargv.c
  3. 2 1
      clish/shell/shell_help.c

+ 9 - 1
clish/command/command.c

@@ -215,6 +215,7 @@ int clish_command_help(const clish_command_t * this, clish_help_t *help,
 	unsigned i;
 	unsigned cnt = 0;
 	unsigned longest = 0;
+	clish_pargv_status_t status;
 
 	if (0 == index)
 		return 0;
@@ -230,7 +231,7 @@ int clish_command_help(const clish_command_t * this, clish_help_t *help,
 	/* get the parameter definition */
 	last = clish_pargv_create();
 	pargv = clish_pargv_create();
-	clish_pargv_parse(pargv, this, viewid, this->paramv,
+	status = clish_pargv_parse(pargv, this, viewid, this->paramv,
 		argv, &idx, last, index);
 	clish_pargv_delete(pargv);
 	cnt = clish_pargv__get_count(last);
@@ -255,6 +256,13 @@ int clish_command_help(const clish_command_t * this, clish_help_t *help,
 	clish_pargv_delete(last);
 	lub_argv_delete(argv);
 
+	/* Add <cr> if command is completed */
+	if (CLISH_LINE_OK == status) {
+		lub_argv_add(help->name, "<cr>");
+		lub_argv_add(help->help, NULL);
+		lub_argv_add(help->detail, NULL);
+	}
+
 	return longest;
 }
 

+ 1 - 1
clish/pargv/pargv.c

@@ -1,5 +1,5 @@
 /*
- * paramv.c
+ * pargv.c
  */
 #include "private.h"
 #include "lub/string.h"

+ 2 - 1
clish/shell/shell_help.c

@@ -67,7 +67,8 @@ void clish_shell_help(clish_shell_t *this, const char *line)
 	for (i = 0; i < lub_argv__get_count(help.name); i++) {
 		fprintf(stderr, "  %-*s  %s\n", (int)max_width,
 			lub_argv__get_arg(help.name, i),
-			lub_argv__get_arg(help.help, i));
+			lub_argv__get_arg(help.help, i) ?
+			lub_argv__get_arg(help.help, i) : "");
 	}
 
 	/* Print details */