git help: sort commands by topi
Subsystems (2)
PATCH 1/1 git help: sort commands by topi
Hi *,
here is a patch that I've sent a lot of times to the list and it has not
arrived, I suppose because the spam filtering, but I've look the filter applied and I do not find anything. I've also compared this with other mails I've sent and I don't see anything relevant. I'm sending the the patch as an attachment.
Santi
P.D: Does anyone know how can I know the reason for the drops?
Quoted 1 line
From
3379f6e84035748fc9d1a14fbfcbc31b20a3582cMon Sep 17 00:00:00 2001
From: =?utf-8?q?Santi=20B=C3=A9jar?= <[email protected]>
Date: Sun, 27 Jan 2008 01:34:57 +0100
Subject: [PATCH] git help -t|--topic: lists all the commands classified by topic
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Additionally shows a hint to get the long list when listing the common commands.
--- Documentation/git-help.txt | 8 +++++- Makefile | 2 +- generate-cmdlist.sh | 28 ++++++++++++++++++------ help.c | 51 ++++++++++++++++++++++++++++++++++++------- topic-list.txt | 12 ++++++++++ 5 files changed, 82 insertions(+), 19 deletions(-) create mode 100644 topic-list.txt
Documentation/git-help.txt +6 -2
@@ -7,7 +7,7 @@ git-help - display help information about git SYNOPSIS -------- -'git help' [-a|--all|-i|--info|-m|--man|-w|--web] [COMMAND] +'git help' [-a|--all|-i|--info|-m|--man|-t|--topic|-w|--web] [COMMAND] DESCRIPTION -----------
@@ -17,7 +17,8 @@ command and a list of the most commonly used git commands are printed on the standard output. If the option '--all' or '-a' is given, then all available commands are -printed on the standard output. +printed on the standard output. For a list of all git commands classified by +topic use '--topic' of '-t'. If a git command is named, a manual page for that command is brought up. The 'man' program is used by default for this purpose, but this
@@ -41,6 +42,9 @@ OPTIONS used to override a value set in the 'help.format' configuration variable. +-t|--topic:: + Prints all the commands classified by topic. + -w|--web:: Use a web browser to display the HTML manual page, instead of the 'man' program that is used by default.
Makefile +1 -1
@@ -837,7 +837,7 @@ git-merge-subtree$X: git-merge-recursive$X $(BUILT_INS): git$X $(QUIET_BUILT_IN)$(RM) $@ && ln git$X $@ -common-cmds.h: ./generate-cmdlist.sh command-list.txt +common-cmds.h: ./generate-cmdlist.sh command-list.txt topic-list.txt common-cmds.h: $(wildcard Documentation/git-*.txt) $(QUIET_GEN)./generate-cmdlist.sh > $@+ && mv $@+ $@
generate-cmdlist.sh +21 -7
@@ -3,22 +3,36 @@ echo "/* Automatically generated by $0 */ struct cmdname_help { - char name[16]; + char name[23]; char help[80]; + char topic[22]; + char subtopic[10]; }; -static struct cmdname_help common_cmds[] = {" +struct topicname_help +{ + char name[23]; + char subtopic[10]; + char help[80]; +}; -sed -n -e 's/^git-\([^ ]*\)[ ].* common.*/\1/p' command-list.txt | -sort | -while read cmd +static struct cmdname_help cmd_list[] = {" + +sed -n -e 's/^git-\([^ ]*\)\(.*\)$/\1\2/p' command-list.txt | +grep -v deprecated | sort | +while read cmd topic subtopic do sed -n ' - /NAME/,/git-'"$cmd"'/H + /^NAME$/,/git-'"$cmd"'/H ${ x - s/.*git-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/ + s/.*git-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1",/ p }' "Documentation/git-$cmd.txt" + echo "\"$topic\", \"$subtopic\" }," done echo "};" + +echo "static struct topicname_help topic_list[] = {" +sed -n -e 's/^topic-\([^ ]*\) \(common\|\) \(.*\)$/{\"\1\", \"\2\", \"\3\"},/p' topic-list.txt +echo "};"
help.c +42 -9
68 lines not on this page · raw message
topic-list.txt new file +12 -0
@@ -0,0 +1,12 @@ +# List of known git topics. +# topic name help +common The most commonly used commands +mainporcelain Main porcelain commands +ancillarymanipulators Interrogators commands +ancillaryinterrogators Manipulators commands +foreignscminterface Commands dealing with foreing SCM +plumbingmanipulators Low-level manipulation commands +plumbinginterrogators Low-level Interrogation commands +synchingrepositories Synching repositories +synchelpers Synching helper commands +purehelpers Internal helper commands
Signature · 1 line
1.5.4.1219.g65b9
Quoted 1 line · Santi Bejar
P.D: Does anyone know how can I know the reason for the drops?
I'd love to know that myself.
It would be interesting to install the kernel's checkpatch.pl as anti-bogo-style filter on the mailing list ;-)
Quoted 5 lines
generate-cmdlist.sh +0
-0
generate-cmdlist.sh line 10
Quoted 9 lines
generate-cmdlist.sh +3
-1@@ -3,22 +3,36 @@ echo "/* Automatically generated by $0 */ struct cmdname_help { - char name[16]; + char name[23]; char help[80]; + char topic[22]; + char subtopic[10]; };
These limits are very magic. If you are generating them in the script perhaps you would want to count bytes?
I dunno. Honestly, I am not very interested in this patch myself.
Side Note: my not being interested does not mean I strongly oppose to its inclusion (I do not even care). It is just that I won't be the one who will be pushing for its inclusion, and you would want supporters other than me to push for it.
generate-cmdlist.sh line 17
Quoted 7 lines
generate-cmdlist.sh +6
-1-static struct cmdname_help common_cmds[] = {" +struct topicname_help +{ + char name[23]; + char subtopic[10]; + char help[80]; +};
Likewise.
generate-cmdlist.sh line 23
Quoted 8 lines
generate-cmdlist.sh +5
-3-sed -n -e 's/^git-\([^ ]*\)[ ].* common.*/\1/p' command-list.txt | -sort | -while read cmd +static struct cmdname_help cmd_list[] = {" + +sed -n -e 's/^git-\([^ ]*\)\(.*\)$/\1\2/p' command-list.txt | +grep -v deprecated | sort | +while read cmd topic subtopic
I do not like this pipeline to send output of sed to an _overly_ loose grep. What happens when we introduce "git-deprecated" command later?
generate-cmdlist.sh line 26
Quoted 4 lines
generate-cmdlist.sh +1
-1do sed -n ' - /NAME/,/git-'"$cmd"'/H + /^NAME$/,/git-'"$cmd"'/H
Good tightening.
generate-cmdlist.sh line 32
Quoted 7 lines
generate-cmdlist.sh +2
-1${ x - s/.*git-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/ + s/.*git-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1",/ p }' "Documentation/git-$cmd.txt" + echo "\"$topic\", \"$subtopic\" },"
Breaks nicely indented entries like:
{"add", "Add file contents...Quoted 5 lines
help.c +0
-0
help.c static void list_commands(void) · line 282
Quoted 9 lines
help.c +6
-0@@ -262,20 +262,48 @@ static void list_commands(void) +for (i =0 ; i <ARRAY_SIZE (cmd_list); i++) { +if (strcmp (cmd_list[i].topic, topic))continue ; +if (!strcmp (topic_list[i].subtopic,"" ) && +strcmp (cmd_list[i].subtopic, subtopic))continue ; +if (longest <strlen (cmd_list[i].name)) + longest =strlen (cmd_list[i].name); }
Style. A statement comes on its own line, even if it is a "continue" statement.
help.c static void list_commands(void) · line 292
Quoted 9 lines
help.c +9
-0+for (i =0 ; i <ARRAY_SIZE (cmd_list); i++) { +if (strcmp (cmd_list[i].topic, topic))continue ; +if (!strcmp (topic_list[i].subtopic,"" ) && +strcmp (cmd_list[i].subtopic, subtopic))continue ; +printf (" %s " , cmd_list[i].name); +mput_char (' ' , longest -strlen (cmd_list[i].name)); +puts (cmd_list[i].help); + } +putchar ('\n' );
Likewise.
help.c static void list_commands(void) · line 308
Quoted 8 lines
help.c +6
-0+void list_topics_help () +{ +int i; +for (i =0 ; i <ARRAY_SIZE (topic_list); i++) { +if (strcmp (topic_list[i].subtopic,"" ))continue ; +list_topic_cmds_help (topic_list[i].name,"" ); } }
Style. Have a SP before '(' if the previous token is not a function name.
topic-list.txt line 12
Quoted 13 lines
topic-list.txt new file +6
-0@@ -0,0 +1,12 @@ +# List of known git topics. +# topic name help +common The most commonly used commands +mainporcelain Main porcelain commands +synchelpers Synching helper commands +purehelpers Internal helper commands
I wonder if this can be shared with the section headings of Documentation/git.txt; either generate the section headings from this file, or generate this file from the section headings.
Quoted 10 lines · Junio C Hamano
Quoted 9 lines · Santi Bejar
generate-cmdlist.sh +0
-1@@ -3,22 +3,36 @@ echo "/* Automatically generated by $0 */ struct cmdname_help { - char name[16];
Quoted 9 lines
generate-cmdlist.sh line 10
Quoted 5 lines
generate-cmdlist.sh +3
-0+ char name[23]; char help[80]; + char topic[22]; + char subtopic[10]; };These limits are very magic. If you are generating them in the script perhaps you would want to count bytes?
They were already there. Maybe in a cleanup patch.
Quoted 8 lines
I dunno. Honestly, I am not very interested in this patch myself.
Side Note: my not being interested does not mean I strongly oppose to its inclusion (I do not even care). It is just that I won't be the one who will be pushing for its inclusion, and you would want supporters other than me to push for it.
OK.
Quoted 11 lines
generate-cmdlist.sh line 17
Quoted 8 lines
generate-cmdlist.sh +6
-1-static struct cmdname_help common_cmds[] = {" +struct topicname_help +{ + char name[23]; + char subtopic[10]; + char help[80]; +};Likewise.
Quoted 12 lines
generate-cmdlist.sh line 23
Quoted 8 lines
generate-cmdlist.sh +5
-3-sed -n -e 's/^git-\([^ ]*\)[ ].* common.*/\1/p' command-list.txt | -sort | -while read cmd +static struct cmdname_help cmd_list[] = {" + +sed -n -e 's/^git-\([^ ]*\)\(.*\)$/\1\2/p' command-list.txt | +grep -v deprecated | sort | +while read cmd topic subtopicI do not like this pipeline to send output of sed to an _overly_ loose grep. What happens when we introduce "git-deprecated" command later?
I'll look at it.
[...]
Quoted 8 lines
generate-cmdlist.sh line 32
Quoted 7 lines
generate-cmdlist.sh +2
-1${ x - s/.*git-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1"},/ + s/.*git-'"$cmd"' - \(.*\)/ {"'"$cmd"'", "\1",/ p }' "Documentation/git-$cmd.txt" + echo "\"$topic\", \"$subtopic\" },"
Quoted 4 lines
Breaks nicely indented entries like:
{"add", "Add file contents...
Sorry, but I do not undestand this.
[...]
Quoted 9 lines
Quoted 9 lines
topic-list.txt new file +3
-0@@ -0,0 +1,12 @@ +# List of known git topics. +# topic name help +common The most commonly used commands
Quoted 8 lines
topic-list.txt line 12
Quoted 4 lines
topic-list.txt new file +3
-0+mainporcelain Main porcelain commands +synchelpers Synching helper commands +purehelpers Internal helper commandsI wonder if this can be shared with the section headings of
Documentation/git.txt; either generate the section headings from this file, or generate this file from the section headings.
I'll look at it.
Thanks for the review.
Santi