summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2013-03-21 16:12:50 +0000
committerNicholas Marriott <nicm@openbsd.org>2013-03-21 16:12:50 +0000
commitdd76497ab01620bf5c7b63205f3e1405f3c34d8c (patch)
tree4a649a6dcb25cfff5b2be1bcd3f6a02dc091fc53
parent9b7e18f166b1f771a2ad3096831bf145731deb1b (diff)
Show alias in lscm output.
-rw-r--r--cmd-list-commands.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/cmd-list-commands.c b/cmd-list-commands.c
index 2ebc206e..261acefb 100644
--- a/cmd-list-commands.c
+++ b/cmd-list-commands.c
@@ -42,8 +42,15 @@ cmd_list_commands_exec(unused struct cmd *self, struct cmd_ctx *ctx)
{
const struct cmd_entry **entryp;
- for (entryp = cmd_table; *entryp != NULL; entryp++)
- ctx->print(ctx, "%s %s", (*entryp)->name, (*entryp)->usage);
+ for (entryp = cmd_table; *entryp != NULL; entryp++) {
+ if ((*entryp)->alias != NULL) {
+ ctx->print(ctx, "%s (%s) %s", (*entryp)->name,
+ (*entryp)->alias, (*entryp)->usage);
+ } else {
+ ctx->print(ctx, "%s %s", (*entryp)->name,
+ (*entryp)->usage);
+ }
+ }
return (CMD_RETURN_NORMAL);
}