diff --git a/urjtag/ChangeLog b/urjtag/ChangeLog index e7925d9e..0f8e3932 100644 --- a/urjtag/ChangeLog +++ b/urjtag/ChangeLog @@ -3,6 +3,9 @@ * src/cmd/cmd.h, src/cmd/cmd_list.h, src/cmd/cmd_cmd.c: Unify the list of commands in one place. + * src/cmd/cmd_cmd.c (urj_cmd_run): Automatically show help for a command + when it fails with a syntax error. + 2010-01-22 Mike Frysinger * src/cmd/cmd_bit.c (cmd_bit_print_params): Fix strncat length handling. diff --git a/urjtag/src/cmd/cmd_cmd.c b/urjtag/src/cmd/cmd_cmd.c index ae3a37b2..a849e7a9 100644 --- a/urjtag/src/cmd/cmd_cmd.c +++ b/urjtag/src/cmd/cmd_cmd.c @@ -105,7 +105,13 @@ urj_cmd_run (urj_chain_t *chain, char *params[]) if (strcasecmp (urj_cmds[i]->name, params[0]) == 0) { run_cmd: - return urj_cmds[i]->run (chain, params); + i = urj_cmds[i]->run (chain, params); + if (i != URJ_STATUS_OK && urj_error_get () == URJ_ERROR_SYNTAX) + { + char *help_params[3] = { "help", params[0], NULL }; + urj_cmd_run( chain, help_params ); + } + return i; } else if (strncasecmp (urj_cmds[i]->name, params[0], len) == 0) {