From: "Sébastien Guimmara" <sebastien.guimmara@gmail.com>
To: git@vger.kernel.org
Cc: "Sébastien Guimmara" <sebastien.guimmara@gmail.com>
Subject: [PATCH v5 2/6] help.c: output the typical Git workflow
Date: Sat, 9 May 2015 19:17:32 +0200 [thread overview]
Message-ID: <1431191856-10949-3-git-send-email-sebastien.guimmara@gmail.com> (raw)
In-Reply-To: <1431191856-10949-1-git-send-email-sebastien.guimmara@gmail.com>
'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 typical Git workflow includes:
* 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: Sébastien Guimmara <sebastien.guimmara@gmail.com>
---
help.c | 25 +++++++++++++++++++++++--
1 file changed, 23 insertions(+), 2 deletions(-)
diff --git a/help.c b/help.c
index 2072a87..1df205f 100644
--- a/help.c
+++ b/help.c
@@ -218,6 +218,18 @@ void list_commands(unsigned int colopts,
}
}
+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;
@@ -227,9 +239,18 @@ void list_common_cmds_help(void)
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(_("The typical Git workflow includes:"));
+
for (i = 0; i < ARRAY_SIZE(common_cmds); i++) {
- printf(" %s ", common_cmds[i].name);
+ 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
next prev parent reply other threads:[~2015-05-09 17:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-09 17:17 [PATCH v5 0/6] git help: group common commands by theme Sébastien Guimmara
2015-05-09 17:17 ` [PATCH v5 1/6] generate-cmdlist: parse common group commands Sébastien Guimmara
2015-05-11 6:12 ` Eric Sunshine
2015-05-09 17:17 ` Sébastien Guimmara [this message]
2015-05-11 6:24 ` [PATCH v5 2/6] help.c: output the typical Git workflow Eric Sunshine
2015-05-09 17:17 ` [PATCH v5 3/6] command-list.txt: group common commands by theme Sébastien Guimmara
2015-05-11 6:20 ` Eric Sunshine
2015-05-09 17:17 ` [PATCH v5 4/6] Makefile: update to new command-list.txt format Sébastien Guimmara
2015-05-11 6:44 ` Eric Sunshine
2015-05-09 17:17 ` [PATCH v5 5/6] new-command.txt: mention the common command groups Sébastien Guimmara
2015-05-11 6:47 ` Eric Sunshine
2015-05-09 17:17 ` [PATCH v5 6/6] cmd-list.perl: ignore all lines until [commands] Sébastien Guimmara
2015-05-11 6:59 ` Eric Sunshine
2015-05-11 5:52 ` [PATCH v5 0/6] git help: 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1431191856-10949-3-git-send-email-sebastien.guimmara@gmail.com \
--to=sebastien.guimmara@gmail.com \
--cc=git@vger.kernel.org \
/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.
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 NNTP newsgroup(s).