From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f195.google.com ([209.85.192.195]:37269 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1163948AbeCBCDG (ORCPT ); Thu, 1 Mar 2018 21:03:06 -0500 Received: by mail-pf0-f195.google.com with SMTP id h11so2920971pfn.4 for ; Thu, 01 Mar 2018 18:03:06 -0800 (PST) From: Jakub Kicinski To: alexei.starovoitov@gmail.com, daniel@iogearbox.net Cc: netdev@vger.kernel.org, oss-drivers@netronome.com, Quentin Monnet Subject: [PATCH bpf-next v2 8/8] tools: bpftool: add bash completion for CFG dump Date: Thu, 1 Mar 2018 18:01:23 -0800 Message-Id: <20180302020123.21951-9-jakub.kicinski@netronome.com> In-Reply-To: <20180302020123.21951-1-jakub.kicinski@netronome.com> References: <20180302020123.21951-1-jakub.kicinski@netronome.com> Sender: netdev-owner@vger.kernel.org List-ID: From: Quentin Monnet Add bash completion for the "visual" keyword used for dumping the CFG of eBPF programs with bpftool. Make sure we only complete with this keyword when we dump "xlated" (and not "jited") instructions. Acked-by: Jiong Wang Signed-off-by: Quentin Monnet Acked-by: Jakub Kicinski --- tools/bpf/bpftool/bash-completion/bpftool | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/bpf/bpftool/bash-completion/bpftool b/tools/bpf/bpftool/bash-completion/bpftool index 08719c54a614..490811b45fa7 100644 --- a/tools/bpf/bpftool/bash-completion/bpftool +++ b/tools/bpf/bpftool/bash-completion/bpftool @@ -147,7 +147,7 @@ _bpftool() # Deal with simplest keywords case $prev in - help|key|opcodes) + help|key|opcodes|visual) return 0 ;; tag) @@ -223,11 +223,16 @@ _bpftool() return 0 ;; *) - _bpftool_once_attr 'file' + _bpftool_once_attr 'file' + if _bpftool_search_list 'xlated'; then + COMPREPLY+=( $( compgen -W 'opcodes visual' -- \ + "$cur" ) ) + else COMPREPLY+=( $( compgen -W 'opcodes' -- \ "$cur" ) ) - return 0 - ;; + fi + return 0 + ;; esac ;; pin) -- 2.15.1