diff options
author | Junio C Hamano <gitster@pobox.com> | 2013-01-18 22:35:04 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2013-01-18 22:35:04 -0800 |
commit | 1542d4cdad9287896fd80d84a4c2256197087308 (patch) | |
tree | c475f4fffca577c8617258c5513f84d22acb5a41 /help.c | |
parent | e4f59a32de3f90ff5aabc09b9da6bd5818c5076b (diff) | |
download | git-1542d4cdad9287896fd80d84a4c2256197087308.tar.gz |
help: include <common-cmds.h> only in one file
This header not only declares but also defines the contents of the
array that holds the list of command names and help text. Do not
include it in multiple places to waste text space.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'help.c')
-rw-r--r-- | help.c | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -223,6 +223,23 @@ void list_commands(unsigned int colopts, } } +void list_common_cmds_help(void) +{ + int i, longest = 0; + + for (i = 0; i < ARRAY_SIZE(common_cmds); i++) { + if (longest < strlen(common_cmds[i].name)) + longest = strlen(common_cmds[i].name); + } + + puts(_("The most commonly used git commands are:")); + for (i = 0; i < ARRAY_SIZE(common_cmds); i++) { + printf(" %s ", common_cmds[i].name); + mput_char(' ', longest - strlen(common_cmds[i].name)); + puts(_(common_cmds[i].help)); + } +} + int is_in_cmdlist(struct cmdnames *c, const char *s) { int i; |