[PATCH v3 2/4] generate-cmdlist.sh: parse common command groups
- From
Sébastien Guimmara <sebastien.guimmara@gmail.com>
- Date
- May 3, 2015, 00:22 UTC
- Message-ID
- <55456A40.80806@gmail.com>
- In-Reply-To
- <55456990.6000509@gmail.com>
Teach generate-cmdlist.sh to parse common command groups found in command-list.txt in the form
common-3_worktree ('3_worktree' being the group identifier)Extract the $grp variable, in addition to the previous $cmd, and inject it as a third field in the cmdname_help struct:
{"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.
Reviewed by: Luke Diamand <luke@diamand.org> Reviewed by: Andreas Schwab <schwab@linux-m68k.org> Signed-off-by: Sébastien Guimmara <sebastien.guimmara@gmail.com> --- generate-cmdlist.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/generate-cmdlist.sh b/generate-cmdlist.sh index 9a4c9b9..98f937b 100755 --- a/generate-cmdlist.sh +++ b/generate-cmdlist.sh @@ -4,19 +4,20 @@ echo "/* Automatically generated by $0 */ struct cmdname_help { char name[16]; char help[80]; + char group[20]; }; 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 IFS=: read cmd grp do sed -n ' /^NAME/,/git-'"$cmd"'/H ${ x - s/.*git-'"$cmd"' - \(.*\)/ {"'"$cmd"'", N_("\1")},/ + s/.*git-'"$cmd"' - \(.*\)/ {"'"$cmd"'", N_("\1"), "'"$grp"'"},/ p }' "Documentation/git-$cmd.txt" done
-- 2.4.0