Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 333955
b: refs/heads/master
c: 4d8061f
h: refs/heads/master
i:
  333953: a328227
  333951: f8bd848
v: v3
  • Loading branch information
Namhyung Kim authored and Arnaldo Carvalho de Melo committed Oct 2, 2012
1 parent 9cf3e5a commit 6eb0da2
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 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: 35c2fde1155cc7225361edf43d8efd0aabd28a0c
refs/heads/master: 4d8061faca7a50010f037374410f0c3647c3ecf8
9 changes: 7 additions & 2 deletions trunk/tools/perf/bash_completion
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,13 @@ _perf()
fi
# List possible events for -e option
elif [[ $prev == "-e" && "${COMP_WORDS[1]}" == @(record|stat|top) ]]; then
cmds=$($cmd list --raw-dump)
COMPREPLY=( $( compgen -W '$cmds' -- "$cur" ) )
evts=$($cmd list --raw-dump)
COMPREPLY=( $( compgen -W '$evts' -- "$cur" ) )
# List long option names
elif [[ $cur == --* ]]; then
subcmd=${COMP_WORDS[1]}
opts=$($cmd $subcmd --list-opts)
COMPREPLY=( $( compgen -W '$opts' -- "$cur" ) )
# Fall down to list regular files
else
_filedir
Expand Down
8 changes: 8 additions & 0 deletions trunk/tools/perf/util/parse-options.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,8 @@ int parse_options_step(struct parse_opt_ctx_t *ctx,
return usage_with_options_internal(usagestr, options, 1);
if (internal_help && !strcmp(arg + 2, "help"))
return parse_options_usage(usagestr, options);
if (!strcmp(arg + 2, "list-opts"))
return PARSE_OPT_LIST;
switch (parse_long_opt(ctx, arg + 2, options)) {
case -1:
return parse_options_usage(usagestr, options);
Expand Down Expand Up @@ -422,6 +424,12 @@ int parse_options(int argc, const char **argv, const struct option *options,
exit(129);
case PARSE_OPT_DONE:
break;
case PARSE_OPT_LIST:
while (options->type != OPTION_END) {
printf("--%s ", options->long_name);
options++;
}
exit(130);
default: /* PARSE_OPT_UNKNOWN */
if (ctx.argv[0][1] == '-') {
error("unknown option `%s'", ctx.argv[0] + 2);
Expand Down
1 change: 1 addition & 0 deletions trunk/tools/perf/util/parse-options.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ extern NORETURN void usage_with_options(const char * const *usagestr,
enum {
PARSE_OPT_HELP = -1,
PARSE_OPT_DONE,
PARSE_OPT_LIST,
PARSE_OPT_UNKNOWN,
};

Expand Down

0 comments on commit 6eb0da2

Please sign in to comment.