diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-03-03 15:16:48 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-03-03 15:16:48 +0900 |
commit | da496b9ac3b57822ca66b82a42c6eee52268781e (patch) | |
tree | 78efafb1ec7e91b141b233a3d502f3cccf8a247f /help.c | |
parent | 76f8656c7d0687cd5ae1d42a76c77b2b46be33b1 (diff) | |
download | git-da496b9ac3b57822ca66b82a42c6eee52268781e.tar.gz git-da496b9ac3b57822ca66b82a42c6eee52268781e.tar.bz2 git-da496b9ac3b57822ca66b82a42c6eee52268781e.zip |
Imported Upstream version 2.20.1upstream/2.20.1
Diffstat (limited to 'help.c')
-rw-r--r-- | help.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -83,8 +83,9 @@ static void print_command_list(const struct cmdname_help *cmds, for (i = 0; cmds[i].name; i++) { if (cmds[i].category & mask) { + size_t len = strlen(cmds[i].name); printf(" %s ", cmds[i].name); - mput_char(' ', longest - strlen(cmds[i].name)); + mput_char(' ', longest > len ? longest - len : 1); puts(_(cmds[i].help)); } } @@ -526,6 +527,13 @@ void list_all_cmds_help(void) git_config(get_alias, &alias_list); string_list_sort(&alias_list); + + for (i = 0; i < alias_list.nr; i++) { + size_t len = strlen(alias_list.items[i].string); + if (longest < len) + longest = len; + } + if (alias_list.nr) { printf("\n%s\n", _("Command aliases")); ALLOC_ARRAY(aliases, alias_list.nr + 1); |