提交 b7d96819 编写于 作者: T Teemu Likonen 提交者: Junio C Hamano

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: NTeemu Likonen <tlikonen@iki.fi>
Signed-off-by: NJunio C Hamano <gitster@pobox.com>
上级 e919cb30
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
extern const char git_version_string[]; extern const char git_version_string[];
extern const char git_usage_string[]; extern const char git_usage_string[];
extern const char git_more_info_string[];
extern void list_common_cmds_help(void); extern void list_common_cmds_help(void);
extern void help_unknown_cmd(const char *cmd); extern void help_unknown_cmd(const char *cmd);
......
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
const char git_usage_string[] = const char git_usage_string[] =
"git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate|--no-pager] [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] [--help] COMMAND [ARGS]"; "git [--version] [--exec-path[=GIT_EXEC_PATH]] [-p|--paginate|--no-pager] [--bare] [--git-dir=GIT_DIR] [--work-tree=GIT_WORK_TREE] [--help] COMMAND [ARGS]";
const char git_more_info_string[] =
"See 'git help COMMAND' for more information on a specific command.";
static int handle_options(const char*** argv, int* argc, int* envchanged) static int handle_options(const char*** argv, int* argc, int* envchanged)
{ {
int handled = 0; int handled = 0;
...@@ -427,6 +430,7 @@ int main(int argc, const char **argv) ...@@ -427,6 +430,7 @@ int main(int argc, const char **argv)
/* The user didn't specify a command; give them help */ /* The user didn't specify a command; give them help */
printf("usage: %s\n\n", git_usage_string); printf("usage: %s\n\n", git_usage_string);
list_common_cmds_help(); list_common_cmds_help();
printf("\n%s\n", git_more_info_string);
exit(1); exit(1);
} }
cmd = argv[0]; cmd = argv[0];
......
...@@ -649,12 +649,14 @@ int cmd_help(int argc, const char **argv, const char *prefix) ...@@ -649,12 +649,14 @@ int cmd_help(int argc, const char **argv, const char *prefix)
if (show_all) { if (show_all) {
printf("usage: %s\n\n", git_usage_string); printf("usage: %s\n\n", git_usage_string);
list_commands(); list_commands();
printf("%s\n", git_more_info_string);
return 0; return 0;
} }
if (!argv[0]) { if (!argv[0]) {
printf("usage: %s\n\n", git_usage_string); printf("usage: %s\n\n", git_usage_string);
list_common_cmds_help(); list_common_cmds_help();
printf("\n%s\n", git_more_info_string);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册