Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/help.c
diff options
context:
space:
mode:
Diffstat (limited to 'help.c')
-rw-r--r--help.c37
1 files changed, 28 insertions, 9 deletions
diff --git a/help.c b/help.c
index 9112a51e84..41c41c2aa1 100644
--- a/help.c
+++ b/help.c
@@ -125,7 +125,9 @@ static void print_cmd_by_category(const struct category_description *catdesc,
uint32_t mask = catdesc[i].category;
const char *desc = catdesc[i].desc;
- printf("\n%s\n", _(desc));
+ if (i)
+ putchar('\n');
+ puts(_(desc));
print_command_list(cmds, mask, longest);
}
free(cmds);
@@ -318,7 +320,7 @@ void list_commands(struct cmdnames *main_cmds, struct cmdnames *other_cmds)
}
if (other_cmds->cnt) {
- printf_ln(_("git commands available from elsewhere on your $PATH"));
+ puts(_("git commands available from elsewhere on your $PATH"));
putchar('\n');
pretty_print_cmdnames(other_cmds, colopts);
putchar('\n');
@@ -328,6 +330,7 @@ void list_commands(struct cmdnames *main_cmds, struct cmdnames *other_cmds)
void list_common_cmds_help(void)
{
puts(_("These are common Git commands used in various situations:"));
+ putchar('\n');
print_cmd_by_category(common_categories, NULL);
}
@@ -433,15 +436,10 @@ static int get_alias(const char *var, const char *value, void *data)
return 0;
}
-void list_all_cmds_help(void)
+static void list_all_cmds_help_external_commands(void)
{
struct string_list others = STRING_LIST_INIT_DUP;
- struct string_list alias_list = STRING_LIST_INIT_DUP;
- struct cmdname_help *aliases;
- int i, longest;
-
- printf_ln(_("See 'git help <command>' to read about a specific subcommand"));
- print_cmd_by_category(main_categories, &longest);
+ int i;
list_all_other_cmds(&others);
if (others.nr)
@@ -449,6 +447,13 @@ void list_all_cmds_help(void)
for (i = 0; i < others.nr; i++)
printf(" %s\n", others.items[i].string);
string_list_clear(&others, 0);
+}
+
+static void list_all_cmds_help_aliases(int longest)
+{
+ struct string_list alias_list = STRING_LIST_INIT_DUP;
+ struct cmdname_help *aliases;
+ int i;
git_config(get_alias, &alias_list);
string_list_sort(&alias_list);
@@ -474,6 +479,20 @@ void list_all_cmds_help(void)
string_list_clear(&alias_list, 1);
}
+void list_all_cmds_help(int show_external_commands, int show_aliases)
+{
+ int longest;
+
+ puts(_("See 'git help <command>' to read about a specific subcommand"));
+ putchar('\n');
+ print_cmd_by_category(main_categories, &longest);
+
+ if (show_external_commands)
+ list_all_cmds_help_external_commands();
+ if (show_aliases)
+ list_all_cmds_help_aliases(longest);
+}
+
int is_in_cmdlist(struct cmdnames *c, const char *s)
{
int i;