builtin/help.c: add --guide option

Logic, but no actions, included. The --all commands option, if given, will display the list of available commands. The --guide option's list of guides will then be displayed. The common commands list is only displayed if neither option, nor a command or guide name, is given. Signed-off-by: Philip Oakley <philipoakley@iee.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Philip Oakley committed Apr 2, 2013 at 23:39 UTC 65f98358c0ca5917604d3eb59b80ce14f72c2c7c
1 file changed +8 -2
builtin/help.c
+8 -2
@@ -36,10 +36,12 @@ enum help_format {
36 static const char *html_path;
37
38 static int show_all = 0;
39 +static int show_guides = 0;
40 static unsigned int colopts;
41 static enum help_format help_format = HELP_FORMAT_NONE;
42 static struct option builtin_help_options[] = {
43 OPT_BOOL('a', "all", &show_all, N_("print all available commands")),
44 + OPT_BOOL('g', "guides", &show_guides, N_("print list of useful guides")),
45 OPT_SET_INT('m', "man", &help_format, N_("show man page"), HELP_FORMAT_MAN),
46 OPT_SET_INT('w', "web", &help_format, N_("show manual in web browser"),
47 HELP_FORMAT_WEB),
@@ -49,7 +51,7 @@ static struct option builtin_help_options[] = {
51 };
52
53 static const char * const builtin_help_usage[] = {
52 - N_("git help [--all] [--man|--web|--info] [command]"),
54 + N_("git help [--all] [--guides] [--man|--web|--info] [command]"),
55 NULL
56 };
57
@@ -430,7 +432,11 @@ int cmd_help(int argc, const char **argv, const char *prefix)
432 list_commands(colopts, &main_cmds, &other_cmds);
433 }
434
433 - if (show_all) {
435 + if (show_guides) {
436 + /* do action - next patch */
437 + }
438 +
439 + if (show_all || show_guides) {
440 printf("%s\n", _(git_more_info_string));
441 /*
442 * We're done. Ignore any remaining args