void list_commands(const char *title, struct cmdnames *main_cmds, struct cmdnames *other_cmds) { unsigned int i, longest = 0; for (i = 0; i < main_cmds->cnt; i++) if (longest < main_cmds->names[i]->len) longest = main_cmds->names[i]->len; for (i = 0; i < other_cmds->cnt; i++) if (longest < other_cmds->names[i]->len) longest = other_cmds->names[i]->len; if (main_cmds->cnt) { char *exec_path = get_argv_exec_path(); printf("available %s in '%s'\n", title, exec_path); printf("----------------"); mput_char('-', strlen(title) + strlen(exec_path)); putchar('\n'); pretty_print_string_list(main_cmds, longest); putchar('\n'); free(exec_path); } if (other_cmds->cnt) { printf("%s available from elsewhere on your $PATH\n", title); printf("---------------------------------------"); mput_char('-', strlen(title)); putchar('\n'); pretty_print_string_list(other_cmds, longest); putchar('\n'); } }
static void print_command_list(const struct cmdname_help *cmds, uint32_t mask, int longest) { int i; for (i = 0; cmds[i].name; i++) { if (cmds[i].category & mask) { printf(" %s ", cmds[i].name); mput_char(' ', longest - strlen(cmds[i].name)); puts(_(cmds[i].help)); } } }
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)); } }
static void print_usage_list_cmds (void) { int i, longest = 0; for (i = 0; i < G_N_ELEMENTS(commands); i++) { if (longest < strlen (commands[i].cmd)) longest = strlen(commands[i].cmd); } puts (_("Available tracker commands are:")); for (i = 0; i < G_N_ELEMENTS(commands); i++) { /* Don't list version in commands */ if (!strcmp (commands[i].cmd, "version") || !strcmp (commands[i].cmd, "help")) { continue; } g_print (" %s ", commands[i].cmd); mput_char (' ', longest - strlen (commands[i].cmd)); puts (_(commands[i].help)); } }