command: Cleaned up and refactored cmd_help

This commit is contained in:
dragonmux 2022-07-26 12:19:43 +01:00 committed by Piotr Esden-Tempski
parent f33744aa6a
commit 5d0e36e668
1 changed files with 4 additions and 6 deletions

View File

@ -170,18 +170,16 @@ bool cmd_help(target *t, int argc, const char **argv)
{
(void)argc;
(void)argv;
const struct command_s *c;
if (!t || t->tc->destroy_callback) {
gdb_out("General commands:\n");
for (c = cmd_list; c->cmd; c++)
gdb_outf("\t%s -- %s\n", c->cmd, c->help);
for (const command_t *cmd = cmd_list; cmd->cmd; cmd++)
gdb_outf("\t%s -- %s\n", cmd->cmd, cmd->help);
if (!t)
return true;
}
if (!t)
return -1;
target_command_help(t);
return true;
}