@matheusbsbs / matheus-bagliano / commits / b7d9681974
Fork 0

Print info about "git help COMMAND" on git's main usage pages

Git's main usage pages did not show "git help" as a way to get more information on a specific subcommand. This patch adds an info line after the list of git commands currently printed by "git", "git help", "git --help" and "git help --all". Signed-off-by: Teemu Likonen <tlikonen@iki.fi> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Teemu Likonen committed Jun 6, 2008 at 00:15 UTC b7d9681974e61959f10c7b2c1063b7781c5b904e
3 files changed +7
builtin.h
+1
@@ -5,6 +5,7 @@
5
6 extern const char git_version_string[];
7 extern const char git_usage_string[];
8 +extern const char git_more_info_string[];
9
10 extern void list_common_cmds_help(void);
11 extern void help_unknown_cmd(const char *cmd);
git.c
+4
@@ -6,6 +6,9 @@
6 const char git_usage_string[] =
7 "git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate|--no-pager] [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] [--help] COMMAND [ARGS]";
8
9 +const char git_more_info_string[] =
10 + "See 'git help COMMAND' for more information on a specific command.";
11 +
12 static int handle_options(const char*** argv, int* argc, int* envchanged)
13 {
14 int handled = 0;
@@ -427,6 +430,7 @@ int main(int argc, const char **argv)
430 /* The user didn't specify a command; give them help */
431 printf("usage: %s\n\n", git_usage_string);
432 list_common_cmds_help();
433 + printf("\n%s\n", git_more_info_string);
434 exit(1);
435 }
436 cmd = argv[0];
help.c
+2
@@ -649,12 +649,14 @@ int cmd_help(int argc, const char **argv, const char *prefix)
649 if (show_all) {
650 printf("usage: %s\n\n", git_usage_string);
651 list_commands();
652 + printf("%s\n", git_more_info_string);
653 return 0;
654 }
655
656 if (!argv[0]) {
657 printf("usage: %s\n\n", git_usage_string);
658 list_common_cmds_help();
659 + printf("\n%s\n", git_more_info_string);
660 return 0;
661 }
662