git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Eric Sunshine <sunshine@sunshineco.com>
Date
May 21, 2015, 14:29 UTC
Message-ID
<CAPig+cRX9_1h4W6sWxb22FF3Hwgqx2f=hK=tQkfTUdkTJiQo-w@mail.gmail.com>
In-Reply-To
<1432213989-3932-6-git-send-email-sebastien.guimmara@gmail.com>

On Thu, May 21, 2015 at 9:13 AM, Sébastien Guimmara <sebastien.guimmara@gmail.com> wrote:

Show 28 quoted lines
> '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 <sebastien.guimmara@gmail.com>
> ---
> 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.
Show 12 quoted lines
> +
>         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
Previous: Sébastien GuimmaraNext: Junio C Hamano
Message 10 of 13 in “group common commands by theme”
  1. 0/5 group common commands by themeSébastien Guimmara, May 21, 2015
  2. 1/5 command-list: prepare machinery for upcoming "common groups" sectionSébastien Guimmara, May 21, 2015
  3. Eric SunshineMay 21, 2015
  4. Sébastien GuimmaraMay 21, 2015
  5. Eric SunshineMay 21, 2015
  6. 2/5 command-list.txt: add the common groups blockSébastien Guimmara, May 21, 2015
  7. 3/5 generate-cmdlist: parse common group commandsSébastien Guimmara, May 21, 2015
  8. 4/5 command-list.txt: drop the "common" tagSébastien Guimmara, May 21, 2015
  9. 5/5 help: respect new common command groupingSébastien Guimmara, May 21, 2015
  10. Eric SunshineMay 21, 2015
  11. Junio C HamanoMay 21, 2015
  12. Eric SunshineMay 21, 2015
  13. Junio C HamanoMay 21, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.