Re: [PATCH v2 2/3] git help: group common commands by theme
- From
Luke Diamand <luke@diamand.org>
- Date
- May 2, 2015, 06:32 UTC
- Message-ID
- <CAE5ih78xxHj-YZVnNB=kNw5ZOkT1t2dcc5yjiUWemEQpwFQfDw@mail.gmail.com>
- In-Reply-To
- <554406FC.8010309@gmail.com>
Hi!
On 2 May 2015 at 00:06, Sébastien Guimmara <sebastien.guimmara@gmail.com> wrote:
Show 10 quoted lines
> Extract the $grp shell variable from command-list.txt (eg:
> 'common-3_worktree') and add
> this value to the output:
>
> before/after:
> {"add", N_("Add file contents to the index")}
> {"add", N_("Add file contents to the index"), "3_worktree"}
>
> So that when 'git' is called, we can display common commands grouped by
> theme instead of a less useful alphabetical order.Seems sensible to me but I'm no expert :-)
Show 16 quoted lines
>
> Signed-off by Sébastien Guimmara <sebastien.guimmara@gmail.com>
> ---
> generate-cmdlist.sh | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
>
> diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh
> index 9a4c9b9..818b2f3 100755
> --- a/generate-cmdlist.sh
> +++ b/generate-cmdlist.sh
> @@ -4,19 +4,22 @@ echo "/* Automatically generated by $0 */
> struct cmdname_help {
> char name[16];
> char help[80];
> + char group[20];Is 20 chars long enough? git-p4 shows up as "foreignscminterface" which is pretty close to that limit.
Show 13 quoted lines
> };
>
> static struct cmdname_help common_cmds[] = {"
>
> -sed -n -e 's/^git-\([^ ]*\)[ ].* common.*/\1/p' command-list.txt |
> +sed -n -e 's/^git-\([^ ]*\)[ ].* common-\(.*\)/\1:\2/p'
> command-list.txt |
> sort |
> -while read cmd
> +while read line
> do
> + cmd=`echo $line | cut -d ':' -f 1`
> + grp=`echo $line | cut -d ':' -f 2`Should this use $(...) rather than `...` ? i.e. cmd=$(echo $(line | cut -d : -f 1)
(And I don't think you need the quotes around the ':'.
Luke