Skip to content

Commit 6fb427a

Browse files
avargitster
authored andcommitted
help.c: split up list_all_cmds_help() function
Split up the listing of commands and aliases from list_all_cmds_help(). This will make a subsequent functional change smaller. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bf7eed7 commit 6fb427a

File tree

1 file changed

+20
-7
lines changed

1 file changed

+20
-7
lines changed

help.c

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -433,22 +433,24 @@ static int get_alias(const char *var, const char *value, void *data)
433433
return 0;
434434
}
435435

436-
void list_all_cmds_help(void)
436+
static void list_all_cmds_help_external_commands(void)
437437
{
438438
struct string_list others = STRING_LIST_INIT_DUP;
439-
struct string_list alias_list = STRING_LIST_INIT_DUP;
440-
struct cmdname_help *aliases;
441-
int i, longest;
442-
443-
puts(_("See 'git help <command>' to read about a specific subcommand"));
444-
print_cmd_by_category(main_categories, &longest);
439+
int i;
445440

446441
list_all_other_cmds(&others);
447442
if (others.nr)
448443
printf("\n%s\n", _("External commands"));
449444
for (i = 0; i < others.nr; i++)
450445
printf(" %s\n", others.items[i].string);
451446
string_list_clear(&others, 0);
447+
}
448+
449+
static void list_all_cmds_help_aliases(int longest)
450+
{
451+
struct string_list alias_list = STRING_LIST_INIT_DUP;
452+
struct cmdname_help *aliases;
453+
int i;
452454

453455
git_config(get_alias, &alias_list);
454456
string_list_sort(&alias_list);
@@ -474,6 +476,17 @@ void list_all_cmds_help(void)
474476
string_list_clear(&alias_list, 1);
475477
}
476478

479+
void list_all_cmds_help(void)
480+
{
481+
int longest;
482+
483+
puts(_("See 'git help <command>' to read about a specific subcommand"));
484+
print_cmd_by_category(main_categories, &longest);
485+
486+
list_all_cmds_help_external_commands();
487+
list_all_cmds_help_aliases(longest);
488+
}
489+
477490
int is_in_cmdlist(struct cmdnames *c, const char *s)
478491
{
479492
int i;

0 commit comments

Comments
 (0)