On Fri, 01 Feb, 2013 at 19:38:12 GMT, Thomas Adam wrote:
> When printing out the command usage, include the command's alias as well.
> ---
>  cmd-list-commands.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/cmd-list-commands.c b/cmd-list-commands.c
> index 68e0e80..b6c2f98 100644
> --- a/cmd-list-commands.c
> +++ b/cmd-list-commands.c
> @@ -43,7 +43,8 @@ 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);
> +             ctx->print(ctx, "%s (%s) %s",
> +                     (*entryp)->name, (*entryp)->alias, (*entryp)->usage);
>  
>       return (CMD_RETURN_NORMAL);
>  }

Hmm. Not all commands have an alias. Maybe:

> -             ctx->print(ctx, "%s %s", (*entryp)->name, (*entryp)->usage);
> +             ctx->print(ctx, "%s (%s) %s",
> +                     (*entryp)->name, (*entryp)->alias ? (*entryp)->alias : 
> "<no alias>", (*entryp)->usage);

(better wrapped of course). I believe with the patch as-is, it would
output:


    kill-server ((null)) ...

--Ben


------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to