From 2014d3b45d0a3f7abbe494b5f4861d4e40e461be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Wed, 28 Sep 2011 19:04:55 +0300 Subject: [PATCH] arping: New completion. --- completions/iputils | 30 ++++++++++++++++++++++++++++++ test/completion/arping.exp | 1 + test/lib/completions/arping.exp | 21 +++++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 test/completion/arping.exp create mode 100644 test/lib/completions/arping.exp diff --git a/completions/iputils b/completions/iputils index 8c36eb16..236cf878 100644 --- a/completions/iputils +++ b/completions/iputils @@ -79,6 +79,36 @@ _tracepath() } && complete -F _tracepath tracepath tracepath6 + +have arping && +_arping() +{ + local cur prev words cword + _init_completion || return + + case $prev in + -c|-w) + return + ;; + -I) + _available_interfaces -a + return + ;; + -s) + _ip_addresses + return + ;; + esac + + if [[ $cur == -* ]]; then + COMPREPLY=( $( compgen -W '$( _parse_help "$1" -h )' -- "$cur" ) ) + return + fi + + _known_hosts_real "$cur" +} && +complete -F _arping arping + # Local variables: # mode: shell-script # sh-basic-offset: 4 diff --git a/test/completion/arping.exp b/test/completion/arping.exp new file mode 100644 index 00000000..5a64b1a3 --- /dev/null +++ b/test/completion/arping.exp @@ -0,0 +1 @@ +assert_source_completions arping diff --git a/test/lib/completions/arping.exp b/test/lib/completions/arping.exp new file mode 100644 index 00000000..531bb07f --- /dev/null +++ b/test/lib/completions/arping.exp @@ -0,0 +1,21 @@ +proc setup {} { + save_env +} + + +proc teardown {} { + assert_env_unmodified +} + + +setup + + +assert_complete_any "arping " +sync_after_int + +assert_complete_any "arping -" +sync_after_int + + +teardown