Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid Commands only produce error message #160

Merged
merged 3 commits into from
May 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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