Skip to content

Commit 25e1167

Browse files
committed
CONSOLE: added optional help arg
1 parent d9850c1 commit 25e1167

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/platform/console/main.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,19 @@ void show_brief_help() {
5858
}
5959

6060
void command_help(const char *selection) {
61-
int len = strlen(selection);
6261
bool found = false;
62+
const char *pattern = "%s\033[50D\033[14C%s\n";
6363
for (int i = 0; i < keyword_help_len; i++) {
64-
if (strncasecmp(selection, keyword_help[i].keyword, len) == 0) {
65-
fprintf(stdout, "%s : %s\n", keyword_help[i].keyword, keyword_help[i].help);
64+
if (selection[0] == '?' || strcasecmp(selection, keyword_help[i].package) == 0) {
65+
fprintf(stdout, pattern, keyword_help[i].keyword, keyword_help[i].help);
6666
found = true;
6767
}
6868
}
6969
if (!found) {
70+
int len = strlen(selection);
7071
for (int i = 0; i < keyword_help_len; i++) {
71-
if (strncasecmp(selection, keyword_help[i].package, len) == 0) {
72-
fprintf(stdout, "%s : %s\n", keyword_help[i].keyword, keyword_help[i].help);
72+
if (strncasecmp(selection, keyword_help[i].keyword, len) == 0) {
73+
fprintf(stdout, pattern, keyword_help[i].keyword, keyword_help[i].help);
7374
found = true;
7475
}
7576
}

0 commit comments

Comments
 (0)