From 851bfba6ede7cf2a01a59077d720e63f59beda4e Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 10 Aug 2022 10:34:59 +0200 Subject: [PATCH] pw-cli: add alias in comand help Add alias to docs and mention alias in help. Fixes #2552 --- man/pw-cli.1.rst.in | 7 ++++--- src/tools/pw-cli.c | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/man/pw-cli.1.rst.in b/man/pw-cli.1.rst.in index 65b9dba31..ca0a2e805 100644 --- a/man/pw-cli.1.rst.in +++ b/man/pw-cli.1.rst.in @@ -34,10 +34,11 @@ Use the 'help' command to list the available commands. GENERAL COMMANDS ================ -help - Show a quick help on the commands available. +help | h + Show a quick help on the commands available. It also lists the aliases + for many commands. -quit +quit | q Exit from **pw-cli** MODULE MANAGEMENT diff --git a/src/tools/pw-cli.c b/src/tools/pw-cli.c index 17ffc4897..33480653f 100644 --- a/src/tools/pw-cli.c +++ b/src/tools/pw-cli.c @@ -269,7 +269,10 @@ static bool do_help(struct data *data, const char *cmd, char *args, char **error printf("Available commands:\n"); for (i = 0; i < SPA_N_ELEMENTS(command_list); i++) { - printf("\t%-20.20s\t%s\n", command_list[i].name, command_list[i].description); + char cmd[256]; + snprintf(cmd, sizeof(cmd), "%s | %s", + command_list[i].name, command_list[i].alias); + printf("\t%-20.20s\t%s\n", cmd, command_list[i].description); } return true; }