mirror of https://github.com/djcb/mu.git
* mu-config: better argument check, print usage info when no command is provided
This commit is contained in:
parent
4aa838f6f6
commit
a9a2e1f94f
|
@ -249,7 +249,7 @@ parse_cmd (MuConfig *opts, int *argcp, char ***argvp)
|
|||
opts->cmdstr = NULL;
|
||||
|
||||
if (*argcp < 2) /* no command found at all */
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
else if ((**argvp)[1] == '-')
|
||||
/* if the first param starts with '-', there is no
|
||||
* command, just some option (like --version, --help
|
||||
|
@ -258,6 +258,7 @@ parse_cmd (MuConfig *opts, int *argcp, char ***argvp)
|
|||
|
||||
opts->cmd = MU_CONFIG_CMD_UNKNOWN;
|
||||
opts->cmdstr = (*argvp)[1];
|
||||
|
||||
for (i = 0; i != G_N_ELEMENTS(cmd_map); ++i)
|
||||
if (strcmp (opts->cmdstr, cmd_map[i]._name) == 0)
|
||||
opts->cmd = cmd_map[i]._cmd;
|
||||
|
|
Loading…
Reference in New Issue