From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: linux-kernel@vger.kernel.org,
Yunlong Song <yunlong.song@huawei.com>,
Paul Mackerras <paulus@samba.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Wang Nan <wangnan0@huawei.com>,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 23/31] perf tools: Add the bash completion for listing subsubcommands of perf data
Date: Thu, 19 Mar 2015 14:04:59 -0300 [thread overview]
Message-ID: <1426784707-19466-24-git-send-email-acme@kernel.org> (raw)
In-Reply-To: <1426784707-19466-1-git-send-email-acme@kernel.org>
From: Yunlong Song <yunlong.song@huawei.com>
The bash completion does not support listing subsubcommands for 'perf
data <TAB>', so fix it.
Example:
Before this patch:
$ perf data <TAB>
$
As shown above, the subsubcommands of perf data does not come out.
After this patch:
$ perf data <TAB>
convert
As shown above, the subsubcommands of perf data can come out now.
Signed-off-by: Yunlong Song <yunlong.song@huawei.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1426685758-25488-8-git-send-email-yunlong.song@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-data.c | 6 ++++--
tools/perf/perf-completion.sh | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/tools/perf/builtin-data.c b/tools/perf/builtin-data.c
index 155cf75b8199..709152a7b408 100644
--- a/tools/perf/builtin-data.c
+++ b/tools/perf/builtin-data.c
@@ -22,7 +22,9 @@ static const struct option data_options[] = {
OPT_END()
};
-static const char * const data_usage[] = {
+static const char * const data_subcommands[] = { "convert", NULL };
+
+static const char *data_usage[] = {
"perf data [<common options>] <command> [<options>]",
NULL
};
@@ -98,7 +100,7 @@ int cmd_data(int argc, const char **argv, const char *prefix)
if (argc < 2)
goto usage;
- argc = parse_options(argc, argv, data_options, data_usage,
+ argc = parse_options_subcommand(argc, argv, data_options, data_subcommands, data_usage,
PARSE_OPT_STOP_AT_NON_OPTION);
if (argc < 1)
goto usage;
diff --git a/tools/perf/perf-completion.sh b/tools/perf/perf-completion.sh
index 7b98ae48f0bf..535ff72babc7 100644
--- a/tools/perf/perf-completion.sh
+++ b/tools/perf/perf-completion.sh
@@ -143,7 +143,7 @@ __perf_main ()
__perfcomp_colon "$evts" "$cur"
else
# List subcommands for perf commands
- if [[ $prev_skip_opts == @(kvm|kmem|mem|lock|sched) ]]; then
+ if [[ $prev_skip_opts == @(kvm|kmem|mem|lock|sched|data) ]]; then
subcmds=$($cmd $prev_skip_opts --list-cmds)
__perfcomp_colon "$subcmds" "$cur"
fi
--
1.9.3
next prev parent reply other threads:[~2015-03-19 17:06 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-19 17:04 [GIT PULL 00/31] perf/core improvements and fixes Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 01/31] perf hists browser: Simplify symbol annotation menu setup Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 02/31] perf hists browser: Fix up some branch alignment Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 03/31] perf hists: Remove hist_entry->used, not used anymore Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 04/31] perf hists browser: Allow annotating entries in callchains Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 05/31] perf tools: Fix building error for arm64 Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 06/31] perf build: Disable default check for libbabeltrace Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 07/31] perf build: Move features build output under features directory Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 08/31] perf build: Fix pthread-attr-setaffinity-np include in test-all Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 09/31] perf build: Get rid of LIB_INCLUDE variable Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 10/31] perf build: Rename CORE_FEATURE_TESTS to FEATURE_TESTS Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 11/31] perf build: Get rid of VF_FEATURE_TESTS Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 12/31] perf build: Rename display_lib into feature_display Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 13/31] perf build: Rename display_vf to feature_verbose Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 14/31] perf build: Rename PERF-FEATURES into FEATURE-DUMP Arnaldo Carvalho de Melo
2015-03-22 10:19 ` Ingo Molnar
2015-03-23 10:57 ` Jiri Olsa
2015-03-23 14:13 ` Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 15/31] perf build: Rename feature_print_var_code to print_var_code Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 17/31] perf tools: Fix the bash completion for listing options of perf subcommand Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 18/31] perf tools: Fix the bash completion for listing subsubcommands " Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 19/31] perf tools: Provide the right bash completion for listing options of perf subcommand subsubcommand Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 20/31] perf tools: Fix the bash completion for listing events of perf subcommand record|stat|top -e Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 21/31] perf tools: Fix the bash completion to support listing events for --event Arnaldo Carvalho de Melo
2015-03-19 17:04 ` [PATCH 22/31] perf tools: Fix the bash completion for listing subcommands of perf Arnaldo Carvalho de Melo
2015-03-19 17:04 ` Arnaldo Carvalho de Melo [this message]
2015-03-19 17:05 ` [PATCH 24/31] perf tools: Add the bash completion for listing subsubcommands of perf help Arnaldo Carvalho de Melo
2015-03-19 17:05 ` [PATCH 25/31] perf tools: Add the bash completion for listing subsubcommands of perf script Arnaldo Carvalho de Melo
2015-03-19 17:05 ` [PATCH 26/31] perf tools: Add the bash completion for listing subsubcommands of perf test Arnaldo Carvalho de Melo
2015-03-19 17:05 ` [PATCH 27/31] perf tools: Add the bash completion for listing subsubcommands of perf timechart Arnaldo Carvalho de Melo
2015-03-19 17:05 ` [PATCH 28/31] perf tools: Add the bash completion for listing subsubcommands of perf trace Arnaldo Carvalho de Melo
2015-03-19 17:05 ` [PATCH 29/31] perf tools: Avoid confusion with preloaded bash function for perf bash completion Arnaldo Carvalho de Melo
2015-03-19 17:05 ` [PATCH 30/31] perf callchain: Separate eh/debug frame offset cache Arnaldo Carvalho de Melo
2015-03-19 17:05 ` [PATCH 31/31] perf report: Don't allow empty argument for '-t' Arnaldo Carvalho de Melo
2015-03-22 9:55 ` [GIT PULL 00/31] perf/core improvements and fixes Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1426784707-19466-24-git-send-email-acme@kernel.org \
--to=acme@kernel.org \
--cc=a.p.zijlstra@chello.nl \
--cc=acme@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=paulus@samba.org \
--cc=wangnan0@huawei.com \
--cc=yunlong.song@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).