Netdev List
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Yotam Gigi <yotamg@mellanox.com>
Cc: netdev@vger.kernel.org, eladr@mellanox.com, idosch@mellanox.com,
	jiri@mellanox.com, jhs@mojatatu.com, mrv@mojatatu.com
Subject: Re: [PATCH net-next/iproute 2/5] tc: bash-completion: Prepare action autocomplete to support several actions
Date: Mon, 6 Feb 2017 14:10:55 -0800	[thread overview]
Message-ID: <20170206141055.5c9f7610@xeon-e3> (raw)
In-Reply-To: <1486387164-40404-3-git-send-email-yotamg@mellanox.com>

On Mon,  6 Feb 2017 15:19:21 +0200
Yotam Gigi <yotamg@mellanox.com> wrote:

> The action autocomplete routine (_tc_action_options) currently does not
> support several actions statements in one tc command line as it uses the
> _tc_once_attr and _tc_one_from_list.
> 
> For example, in that case:
> 
> $ tc filter add dev eth0 handle ffff: u32 [...]  \
> 	   action sample group 5 rate 12 	 \
> 	   action sample <TAB>
> 
> the _tc_once_attr function, when invoked with "group rate" will not
> suggest those as they already exist on the command line.
> 
> Fix the function to use the _from variant, thus allowing each action
> autocomplete start from the action keyword, and not from the beginning of
> the command line.
> 
> Signed-off-by: Yotam Gigi <yotamg@mellanox.com>

This patch does not apply cleanly to current iproute2 net-next tree.
Please rebase and resubmit the whole series again.


$ cat bash-completion/tc.rej 
--- bash-completion/tc
+++ bash-completion/tc
@@ -454,26 +454,28 @@ _tc_filter_options()
 # Returns 0 is completion should stop after running this function, 1 otherwise.
 _tc_action_options()
 {
-    case $1 in
+    local from=$1
+    local action=${words[from]}
+    case $action in
         bpf)
             _tc_bpf_options
             return 0
             ;;
         mirred)
-            _tc_one_of_list 'ingress egress'
-            _tc_one_of_list 'mirror redirect'
-            _tc_once_attr 'index dev'
+            _tc_one_of_list_from $from 'ingress egress'
+            _tc_one_of_list_from $from 'mirror redirect'
+            _tc_once_attr_from $from 'index dev'
             return 0
             ;;
         sample)
-            _tc_once_attr 'rate'
-            _tc_once_attr 'trunc'
-            _tc_once_attr 'group'
+            _tc_once_attr_from $from 'rate'
+            _tc_once_attr_from $from 'trunc'
+            _tc_once_attr_from $from 'group'
             return 0
             ;;
         gact)
-            _tc_one_of_list 'reclassify drop continue pass'
-            _tc_once_attr 'random'
+            _tc_one_of_list_from $from 'reclassify drop continue pass'
+            _tc_once_attr_from $from 'random'
             return 0
             ;;
     esac

  reply	other threads:[~2017-02-06 22:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-06 13:19 [PATCH net-next/iproute 0/5] tc: bash-completion: Add features Yotam Gigi
2017-02-06 13:19 ` [PATCH net-next/iproute 1/5] tc: bash-completion: Add the _from variant to _tc_one* funcs Yotam Gigi
2017-02-06 13:19 ` [PATCH net-next/iproute 2/5] tc: bash-completion: Prepare action autocomplete to support several actions Yotam Gigi
2017-02-06 22:10   ` Stephen Hemminger [this message]
2017-02-07  5:09     ` Yotam Gigi
2017-02-06 13:19 ` [PATCH net-next/iproute 3/5] tc: bash-completion: Make the *_KIND variables global Yotam Gigi
2017-02-06 13:19 ` [PATCH net-next/iproute 4/5] tc: bash-completion: Add support for filter actions Yotam Gigi
2017-02-06 13:19 ` [PATCH net-next/iproute 5/5] tc: bash-completion: Add support for matchall Yotam Gigi

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=20170206141055.5c9f7610@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=eladr@mellanox.com \
    --cc=idosch@mellanox.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@mellanox.com \
    --cc=mrv@mojatatu.com \
    --cc=netdev@vger.kernel.org \
    --cc=yotamg@mellanox.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