summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--avr/command.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/avr/command.c b/avr/command.c
index b579a5e..ff52757 100644
--- a/avr/command.c
+++ b/avr/command.c
@@ -380,11 +380,20 @@ command_ret_t do_help(cmd_tbl_t *cmdtp, uint_fast8_t flag UNUSED, int argc, char
/* command help (long version) */
for (uint_fast8_t argi = 0; argi < argc; ++argi) {
uint_fast8_t got = 0;
-
- for (uint_fast8_t cmdi = 0; cmdi < cmd_items; cmdi++) {
- if (strcmp_P(argv[argi], cmd_list[cmdi]->name) == 0) {
- cmd_usage(cmd_list[cmdi]);
- got = 1;
+ cmd_tbl_t *tp = find_cmd(argv[argi], tbl_start);
+ if (tp) {
+ cmd_usage(tp);
+ got = 1;
+ }
+ if (options & OPT_ALL) {
+ for (cmd_tbl_t *sub = tbl_start; sub->name != NULL; sub++) {
+ if (sub->subcmd) {
+ tp = find_cmd(argv[argi], sub->subcmd);
+ if (tp) {
+ cmd_usage(tp);
+ got = 1;
+ }
+ }
}
}
if (!got) {