Skip to content

Commit

Permalink
Merge branch 'jc/help' into maint
Browse files Browse the repository at this point in the history
* jc/help:
  help: include <common-cmds.h> only in one file
  • Loading branch information
Junio C Hamano committed Feb 4, 2013
2 parents 686b895 + 1542d4c commit ba8748e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
18 changes: 0 additions & 18 deletions builtin/help.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "cache.h"
#include "builtin.h"
#include "exec_cmd.h"
#include "common-cmds.h"
#include "parse-options.h"
#include "run-command.h"
#include "column.h"
Expand Down Expand Up @@ -287,23 +286,6 @@ static int git_help_config(const char *var, const char *value, void *cb)

static struct cmdnames main_cmds, other_cmds;

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 int is_git_command(const char *s)
{
return is_in_cmdlist(&main_cmds, s) ||
Expand Down
17 changes: 17 additions & 0 deletions help.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit ba8748e

Please sign in to comment.