summaryrefslogtreecommitdiff
path: root/src/helper
diff options
context:
space:
mode:
authorZachary T Welch <zw@superlucidity.net>2009-11-29 14:29:24 -0800
committerZachary T Welch <zw@superlucidity.net>2009-11-30 16:29:24 -0800
commitc0630d8a58c525e09aa938c7a50d4c99d39a93a3 (patch)
tree63044ecb9a38ac2a5727d5852957f64d09a2b94a /src/helper
parentcee1f39f18296a3aa291b806052c7c3d5a066347 (diff)
downloadopenocd+libswd-c0630d8a58c525e09aa938c7a50d4c99d39a93a3.tar.gz
openocd+libswd-c0630d8a58c525e09aa938c7a50d4c99d39a93a3.tar.bz2
openocd+libswd-c0630d8a58c525e09aa938c7a50d4c99d39a93a3.tar.xz
openocd+libswd-c0630d8a58c525e09aa938c7a50d4c99d39a93a3.zip
only display usable commands in help
With the ability to defer 'init', users can access the help system while still in CONFIG mode. This patch omits commands from the help and usage list when they cannot be run in the current command mode, making it much easier to see what can be done at a given time.
Diffstat (limited to 'src/helper')
-rw-r--r--src/helper/command.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/helper/command.c b/src/helper/command.c
index ce857dd6..ac7c8d88 100644
--- a/src/helper/command.c
+++ b/src/helper/command.c
@@ -872,6 +872,9 @@ static void command_help_show_wrap(const char *str, unsigned n, unsigned n2)
static COMMAND_HELPER(command_help_show, struct command *c, unsigned n,
bool show_help)
{
+ if (!command_can_run(CMD_CTX, c))
+ return ERROR_OK;
+
char *cmd_name = command_name(c, ' ');
if (NULL == cmd_name)
return -ENOMEM;