Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 333942
b: refs/heads/master
c: 2bae1d1
h: refs/heads/master
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo committed Oct 2, 2012
1 parent d74fc2a commit 7c0bfcb
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 69b6470e9ef3f6ea72b7e46e140d85970d8e1bc8
refs/heads/master: 2bae1d1b1aa3b763b99431101a04dfe24ec5ba7f
40 changes: 20 additions & 20 deletions trunk/tools/perf/builtin-help.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,23 +30,6 @@ enum help_format {
HELP_FORMAT_WEB,
};

static bool show_all = false;
static enum help_format help_format = HELP_FORMAT_NONE;
static struct option builtin_help_options[] = {
OPT_BOOLEAN('a', "all", &show_all, "print all available commands"),
OPT_SET_UINT('m', "man", &help_format, "show man page", HELP_FORMAT_MAN),
OPT_SET_UINT('w', "web", &help_format, "show manual in web browser",
HELP_FORMAT_WEB),
OPT_SET_UINT('i', "info", &help_format, "show info page",
HELP_FORMAT_INFO),
OPT_END(),
};

static const char * const builtin_help_usage[] = {
"perf help [--all] [--man|--web|--info] [command]",
NULL
};

static enum help_format parse_help_format(const char *format)
{
if (!strcmp(format, "man"))
Expand Down Expand Up @@ -258,11 +241,13 @@ static int add_man_viewer_info(const char *var, const char *value)

static int perf_help_config(const char *var, const char *value, void *cb)
{
enum help_format *help_formatp = cb;

if (!strcmp(var, "help.format")) {
if (!value)
return config_error_nonbool(var);
help_format = parse_help_format(value);
if (help_format == HELP_FORMAT_NONE)
*help_formatp = parse_help_format(value);
if (*help_formatp == HELP_FORMAT_NONE)
return -1;
return 0;
}
Expand Down Expand Up @@ -428,12 +413,27 @@ static int show_html_page(const char *perf_cmd)

int cmd_help(int argc, const char **argv, const char *prefix __maybe_unused)
{
bool show_all = false;
enum help_format help_format = HELP_FORMAT_NONE;
struct option builtin_help_options[] = {
OPT_BOOLEAN('a', "all", &show_all, "print all available commands"),
OPT_SET_UINT('m', "man", &help_format, "show man page", HELP_FORMAT_MAN),
OPT_SET_UINT('w', "web", &help_format, "show manual in web browser",
HELP_FORMAT_WEB),
OPT_SET_UINT('i', "info", &help_format, "show info page",
HELP_FORMAT_INFO),
OPT_END(),
};
const char * const builtin_help_usage[] = {
"perf help [--all] [--man|--web|--info] [command]",
NULL
};
const char *alias;
int rc = 0;

load_command_list("perf-", &main_cmds, &other_cmds);

perf_config(perf_help_config, NULL);
perf_config(perf_help_config, &help_format);

argc = parse_options(argc, argv, builtin_help_options,
builtin_help_usage, 0);
Expand Down

0 comments on commit 7c0bfcb

Please sign in to comment.