summaryrefslogtreecommitdiff
path: root/builtin/help.c
diff options
context:
space:
mode:
authorPhilip Oakley <philipoakley@iee.org>2013-04-02 22:39:51 (GMT)
committerJunio C Hamano <gitster@pobox.com>2013-04-03 01:09:30 (GMT)
commit002b726a400a1dea16c0b59ae61527a1e55799fb (patch)
treee5bed46986772b67079e5d5a46d92698447f876c /builtin/help.c
parent65f98358c0ca5917604d3eb59b80ce14f72c2c7c (diff)
downloadgit-002b726a400a1dea16c0b59ae61527a1e55799fb.zip
git-002b726a400a1dea16c0b59ae61527a1e55799fb.tar.gz
git-002b726a400a1dea16c0b59ae61527a1e55799fb.tar.bz2
builtin/help.c: add list_common_guides_help() function
This implements what "help -g" introduced in the previous step does. Signed-off-by: Philip Oakley <philipoakley@iee.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/help.c')
-rw-r--r--builtin/help.c36
1 files changed, 33 insertions, 3 deletions
diff --git a/builtin/help.c b/builtin/help.c
index 03d432b..034c36c 100644
--- a/builtin/help.c
+++ b/builtin/help.c
@@ -415,6 +415,37 @@ static void show_html_page(const char *git_cmd)
open_html(page_path.buf);
}
+static struct {
+ const char *name;
+ const char *help;
+} common_guides[] = {
+ { "attributes", "Defining attributes per path" },
+ { "glossary", "A Git glossary" },
+ { "ignore", "Specifies intentionally untracked files to ignore" },
+ { "modules", "Defining submodule properties" },
+ { "revisions", "Specifying revisions and ranges for Git" },
+ { "tutorial", "A tutorial introduction to Git (for version 1.5.1 or newer)" },
+ { "workflows", "An overview of recommended workflows with Git"},
+};
+
+static void list_common_guides_help(void)
+{
+ int i, longest = 0;
+
+ for (i = 0; i < ARRAY_SIZE(common_guides); i++) {
+ if (longest < strlen(common_guides[i].name))
+ longest = strlen(common_guides[i].name);
+ }
+
+ puts(_("The common Git guides are:\n"));
+ for (i = 0; i < ARRAY_SIZE(common_guides); i++) {
+ printf(" %s ", common_guides[i].name);
+ mput_char(' ', longest - strlen(common_guides[i].name));
+ puts(_(common_guides[i].help));
+ }
+ putchar('\n');
+}
+
int cmd_help(int argc, const char **argv, const char *prefix)
{
int nongit;
@@ -432,9 +463,8 @@ int cmd_help(int argc, const char **argv, const char *prefix)
list_commands(colopts, &main_cmds, &other_cmds);
}
- if (show_guides) {
- /* do action - next patch */
- }
+ if (show_guides)
+ list_common_guides_help();
if (show_all || show_guides) {
printf("%s\n", _(git_more_info_string));