git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: "Sébastien Guimmara" <sebastien.guimmara@gmail.com>
Cc: Git List <git@vger.kernel.org>,
	Junio C Hamano <gitster@pobox.com>,
	Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Subject: Re: [PATCH v11 5/5] help: respect new common command grouping
Date: Thu, 21 May 2015 14:04:58 -0400	[thread overview]
Message-ID: <CAPig+cQ0ExDCoSU_P02on0U+8WXbyGbZecK-4vrUVFp1Mo11hA@mail.gmail.com> (raw)
In-Reply-To: <1432229962-21405-6-git-send-email-sebastien.guimmara@gmail.com>

On Thu, May 21, 2015 at 1:39 PM, Sébastien Guimmara
<sebastien.guimmara@gmail.com> wrote:
> 'git help' shows common commands in alphabetical order:
>
> The most commonly used git commands are:
>    add        Add file contents to the index
>    bisect     Find by binary search the change that introduced a bug
>    branch     List, create, or delete branches
>    checkout   Checkout a branch or paths to the working tree
>    clone      Clone a repository into a new directory
>    commit     Record changes to the repository
>    [...]
>
> 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:
>
> The most commonly used git commands are:

The above line in the commit message does not match the actual output:

    "These are common Git commands used in various situations:"

> start a working area (see also: git help tutorial)
>    clone      Clone a repository into a new directory
>    init       Create an empty Git repository or reinitialize [...]
>
> work on the current change (see also: git help everyday)
>    add        Add file contents to the index
>    reset      Reset current HEAD to the specified state
>
> examine the history and state (see also: git help revisions)
>    log        Show commit logs
>    status     Show the working tree status
>
>    [...]
>
> Helped-by: Eric Sunshine <sunshine@sunshineco.com>
> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
> 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,
>         }
>  }
>
> +static int cmd_group_cmp(const void *elem1, const void *elem2)
> +{
> +       const struct cmdname_help *e1 = elem1;
> +       const struct cmdname_help *e2 = elem2;
> +
> +       if (e1->group < e2->group)
> +               return -1;
> +       if (e1->group > e2->group)
> +               return 1;
> +       return strcmp(e1->name, e2->name);
> +}
> +
>  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:"));
> +
>         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

  reply	other threads:[~2015-05-21 18:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-21 17:39 [PATCH v11 0/5] group common commands by theme Sébastien Guimmara
2015-05-21 17:39 ` [PATCH v11 1/5] command-list: prepare machinery for upcoming "common groups" section Sébastien Guimmara
2015-05-21 17:39 ` [PATCH v11 2/5] command-list.txt: add the common groups block Sébastien Guimmara
2015-05-21 18:01   ` Eric Sunshine
2015-05-25 17:31     ` Sébastien Guimmara
2015-05-26 18:31       ` Eric Sunshine
2015-05-26 19:13         ` Junio C Hamano
2015-05-21 17:39 ` [PATCH v11 3/5] generate-cmdlist: parse common group commands Sébastien Guimmara
2015-05-21 17:39 ` [PATCH v11 4/5] command-list.txt: drop the "common" tag Sébastien Guimmara
2015-05-21 17:39 ` [PATCH v11 5/5] help: respect new common command grouping Sébastien Guimmara
2015-05-21 18:04   ` Eric Sunshine [this message]
2015-05-25 17:25     ` Sébastien Guimmara
2015-05-21 18:15 ` [PATCH v11 0/5] group common commands by theme Eric Sunshine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPig+cQ0ExDCoSU_P02on0U+8WXbyGbZecK-4vrUVFp1Mo11hA@mail.gmail.com \
    --to=sunshine@sunshineco.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=ramsay@ramsay1.demon.co.uk \
    --cc=sebastien.guimmara@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).