Thread (10 messages) 10 messages, 2 authors, 2016-06-15

Re: [PATCH v10 5/5] help: respect new common command grouping

From: Eric Sunshine <hidden>
Date: 2016-06-15 23:04:51

On Thu, May 21, 2015 at 9:13 AM, Sébastien Guimmara
[off-list ref] wrote:
quoted hunk ↗ jump to hunk
'git help' shows common commands in alphabetical order:
[...]
without any indication of how commands relate to high-level
concepts or each other. Revise the output to explain their relationship
with the typical Git workflow:
[...]
Signed-off-by: Sébastien Guimmara <redacted>
---
diff --git a/help.c b/help.c
index 2072a87..8f72051 100644
--- a/help.c
+++ b/help.c
@@ -218,17 +218,39 @@ void list_commands(unsigned int colopts,
 void list_common_cmds_help(void)
 {
        int i, longest = 0;
+       int current_grp = -1;

        for (i = 0; i < ARRAY_SIZE(common_cmds); i++) {
                if (longest < strlen(common_cmds[i].name))
                        longest = strlen(common_cmds[i].name);
        }

-       puts(_("The most commonly used git commands are:"));
+       qsort(common_cmds, ARRAY_SIZE(common_cmds),
+               sizeof(common_cmds[0]), cmd_group_cmp);
+
+       puts(_("These are common Git commands used in various situations:"));
The clause "in various situations" is quite nebulous and thus adds no
substance. If you remove it, then you're effectively left with the
original

    "The most commonly used git commands are:"

which reads just as well or better and has the attribute of being more
concise. I'd opt to drop this change and just keep the original
wording.

Other than that minor observation, the patch looks fine.
+
        for (i = 0; i < ARRAY_SIZE(common_cmds); i++) {
+               if (common_cmds[i].group != current_grp) {
+                       printf("\n%s\n", _(common_cmd_groups[common_cmds[i].group]));
+                       current_grp = common_cmds[i].group;
+               }
+
                printf("   %s   ", common_cmds[i].name);
                mput_char(' ', longest - strlen(common_cmds[i].name));
                puts(_(common_cmds[i].help));
--
2.4.0.GIT
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help