Skip to content

Commit

Permalink
Merge pull request #160 from kanurag94/issue_155
Browse files Browse the repository at this point in the history
Invalid Commands only produce error message
  • Loading branch information
kanurag94 authored May 28, 2020
2 parents b152477 + d78e7ee commit d9b4236
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/ui/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,12 @@ int ui_params_parser(int argc, char **argv)
int is;
const struct params *par = NULL;
int error = 0;
int show_help = 0;
int found;
for (i = 1; i < argc && !error; i++) {
found = 0;
if (!strcmp("-help", argv[i])) {
error = 1;
show_help = 1;
break;
}
for (d = 0; d < nparams; d++) {
Expand Down Expand Up @@ -182,6 +183,9 @@ int ui_params_parser(int argc, char **argv)
i = ie;
}
if (error) {
return 0;
}
if (show_help) {
const char *name[] = {"", "number", "string", "f.point"};
printf(" XaoS" XaoS_VERSION " help text\n\n");
printf("option string param description\n\n");
Expand Down
2 changes: 1 addition & 1 deletion src/util/xmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ int menu_processargs(int n, int argc, char **argv)
margv = argv;
error = menu_processcommand(NULL, gettoken, 0, MENUFLAG_NOOPTION, "root");
if (error) {
x_error("%s", error);
x_error("%s\nPlease enter `xaos -help` to learn more on command line options", error);
return -1;
}
return (argpos - 2);
Expand Down

0 comments on commit d9b4236

Please sign in to comment.