diff options
author | Greg Bellows <greg.bellows@linaro.org> | 2014-11-20 09:32:14 -0600 |
---|---|---|
committer | Greg Bellows <greg.bellows@linaro.org> | 2014-11-20 11:16:23 -0600 |
commit | 74831e12e27e73ead651008dd9beb1a0a23aac9d (patch) | |
tree | 659a30c98ef2bbd60b9c54f6f8293035f5f23a81 | |
parent | 30ac80cbebe755aedea45f7ab2b16cc08c390317 (diff) |
android-console: Fix android_console_help call order
Fixes the order and hierarchy of handler calling so that commands with
sub-tables take priority over parent only commands. This allows nesting of
commands with sub-tables to be called properly.
Signed-off-by: Greg Bellows <greg.bellows@linaro.org>
-rw-r--r-- | monitor.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -991,15 +991,15 @@ static void android_console_help(Monitor *mon, const QDict *qdict) thisarg++; if (thisarg >= nb_args || !cmd->sub_table) { - /* For subtables, the command handler for the entry in the 1st - * level of commands deals with help (including "help subcommand" - * where there is no following second level command in the help - * string). For top level commands, we just print the short text. + /* Last in line commands with sub-tables will deal with their own + * help messages. Otherwise, the parent handles the next lower + * level sub-command. Top level commands (no sub-commands) are + * dealt with here. */ - if (parent_cmd) { - parent_cmd->mhandler.cmd(mon, qdict); - } else if (cmd->sub_table) { + if (cmd->sub_table) { cmd->mhandler.cmd(mon, qdict); + } else if (parent_cmd) { + parent_cmd->mhandler.cmd(mon, qdict); } else { monitor_printf(mon, "%s\nOK\n", cmd->help); } |