mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] perf list: Replace --raw-dump with parse_options_subcommand()
@ 2014-03-27  0:04 Ramkumar Ramachandra
  2014-03-27 21:20 ` Ramkumar Ramachandra
  0 siblings, 1 reply; 2+ messages in thread
From: Ramkumar Ramachandra @ 2014-03-27  0:04 UTC (permalink / raw)
  To: LKML; +Cc: Jiri Olsa, David Ahern, Arnaldo Carvalho de Melo

While adding usage information, 44d742e (perf list: Add usage,
2013-10-30) broke

  $ perf list --raw-dump

Remove this option, and use parse_options_subcommand() to provide a
'--list-cmds'. The argument to 'perf list' is now treated like a
subcommand. Update the completion script to reflect this change.

Fixes: 44d742e01e6d (perf list: Add usage)
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 tools/perf/builtin-list.c     | 13 +++++++------
 tools/perf/perf-completion.sh |  6 +++---
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/tools/perf/builtin-list.c b/tools/perf/builtin-list.c
index 011195e..4e9e4e3 100644
--- a/tools/perf/builtin-list.c
+++ b/tools/perf/builtin-list.c
@@ -22,13 +22,16 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
 	const struct option list_options[] = {
 		OPT_END()
 	};
-	const char * const list_usage[] = {
-		"perf list [hw|sw|cache|tracepoint|pmu|event_glob]",
+	const char *const list_subcommands[] = { "hw", "sw", "cache", "tracepoint",
+						 "pmu", NULL };
+
+	const char *list_usage[] = {
+		"perf list {hw|sw|cache|tracepoint|pmu|event_glob}",
 		NULL
 	};
 
-	argc = parse_options(argc, argv, list_options, list_usage,
-			     PARSE_OPT_STOP_AT_NON_OPTION);
+	argc = parse_options_subcommand(argc, argv, list_options, list_subcommands,
+					list_usage, PARSE_OPT_STOP_AT_NON_OPTION);
 
 	setup_pager();
 
@@ -53,8 +56,6 @@ int cmd_list(int argc, const char **argv, const char *prefix __maybe_unused)
 			print_hwcache_events(NULL, false);
 		else if (strcmp(argv[i], "pmu") == 0)
 			print_pmu_events(NULL, false);
-		else if (strcmp(argv[i], "--raw-dump") == 0)
-			print_events(NULL, true);
 		else {
 			char *sep = strchr(argv[i], ':'), *s;
 			int sep_idx;
diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index ae3a576..a1f867b 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -119,10 +119,10 @@ __perf_main ()
 		fi
 	# List possible events for -e option
 	elif [[ $prev == "-e" && "${words[1]}" == @(record|stat|top) ]]; then
-		evts=$($cmd list --raw-dump)
+		evts=$($cmd list --list-cmds)
 		__perfcomp_colon "$evts" "$cur"
-	# List subcommands for 'perf kvm'
-	elif [[ $prev == "kvm" ]]; then
+	# List subcommands for perf commands
+	elif [[ $prev == @(kvm|list) ]]; then
 		subcmds=$($cmd $prev --list-cmds)
 		__perfcomp_colon "$subcmds" "$cur"
 	# List long option names
-- 
1.9.0.431.g014438b


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] perf list: Replace --raw-dump with parse_options_subcommand()
  2014-03-27  0:04 [PATCH] perf list: Replace --raw-dump with parse_options_subcommand() Ramkumar Ramachandra
@ 2014-03-27 21:20 ` Ramkumar Ramachandra
  0 siblings, 0 replies; 2+ messages in thread
From: Ramkumar Ramachandra @ 2014-03-27 21:20 UTC (permalink / raw)
  To: LKML; +Cc: Jiri Olsa, David Ahern, Arnaldo Carvalho de Melo

Ramkumar Ramachandra wrote:
>  tools/perf/builtin-list.c     | 13 +++++++------
>  tools/perf/perf-completion.sh |  6 +++---
>  2 files changed, 10 insertions(+), 9 deletions(-)

Please ignore this patch. Major thinko on my part.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-03-27 21:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-27  0:04 [PATCH] perf list: Replace --raw-dump with parse_options_subcommand() Ramkumar Ramachandra
2014-03-27 21:20 ` Ramkumar Ramachandra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®