[Bash-completion-commits] [SCM] bash-completion branch, master, updated. 2.0-137-g12ae7eb
Ville Skyttä
ville.skytta at iki.fi
Mon Feb 25 14:50:34 UTC 2013
The following commit has been merged in the master branch:
commit 12ae7eb21451710492a8bc450e07f6c3bd79a4ec
Author: Ville Skyttä <ville.skytta at iki.fi>
Date: Mon Feb 25 16:50:21 2013 +0200
ss: New completion.
diff --git a/completions/Makefile.am b/completions/Makefile.am
index 38450ac..96e3f71 100644
--- a/completions/Makefile.am
+++ b/completions/Makefile.am
@@ -306,6 +306,7 @@ bashcomp_DATA = a2x \
smbclient \
snownews \
sqlite3 \
+ ss \
ssh \
ssh-add \
ssh-copy-id \
diff --git a/completions/ss b/completions/ss
new file mode 100644
index 0000000..655f1f1
--- /dev/null
+++ b/completions/ss
@@ -0,0 +1,39 @@
+# ss(8) completion -*- shell-script -*-
+
+_ss()
+{
+ local cur prev words cword split
+ _init_completion -s || return
+
+ case $prev in
+ -h|--help|-V|--version)
+ return
+ ;;
+ -f|--family)
+ COMPREPLY=( $( compgen -W 'unix inet inet6 link netlink' \
+ -- "$cur" ) )
+ return
+ ;;
+ -A|--query)
+ local prefix=; [[ $cur == *,* ]] && prefix="${cur%,*},"
+ COMPREPLY=( $( compgen -P "$prefix" -W '$( "$1" --help | \
+ sed -e "s/|/ /g" -ne "s/.*QUERY := {\([^}]*\)}.*/\1/p" )' \
+ -- "${cur##*,}" ) )
+ return
+ ;;
+ -D|--diag|-F|--filter)
+ _filedir
+ return
+ ;;
+ esac
+
+ $split && return
+
+ if [[ $cur == -* ]]; then
+ COMPREPLY=( $( compgen -W '$( _parse_help "$1" )' -- "$cur" ) )
+ [[ $COMPREPLY == *= ]] && compopt -o nospace
+ fi
+} &&
+complete -F _ss ss
+
+# ex: ts=4 sw=4 et filetype=sh
diff --git a/test/completion/ss.exp b/test/completion/ss.exp
new file mode 100644
index 0000000..f870388
--- /dev/null
+++ b/test/completion/ss.exp
@@ -0,0 +1 @@
+assert_source_completions ss
diff --git a/test/lib/completions/ping.exp b/test/lib/completions/ss.exp
similarity index 69%
copy from test/lib/completions/ping.exp
copy to test/lib/completions/ss.exp
index 9ef7f2f..f6e711c 100644
--- a/test/lib/completions/ping.exp
+++ b/test/lib/completions/ss.exp
@@ -11,10 +11,10 @@ proc teardown {} {
setup
-assert_complete_any "ping "
+assert_complete_any "ss -"
sync_after_int
-assert_complete_any "ping -"
+assert_complete_any "ss -A "
sync_after_int
--
bash-completion
More information about the Bash-completion-commits
mailing list