ss: New completion.
This commit is contained in:
parent
ad8d1f1a8f
commit
12ae7eb214
@ -306,6 +306,7 @@ bashcomp_DATA = a2x \
|
||||
smbclient \
|
||||
snownews \
|
||||
sqlite3 \
|
||||
ss \
|
||||
ssh \
|
||||
ssh-add \
|
||||
ssh-copy-id \
|
||||
|
39
completions/ss
Normal file
39
completions/ss
Normal file
@ -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
|
1
test/completion/ss.exp
Normal file
1
test/completion/ss.exp
Normal file
@ -0,0 +1 @@
|
||||
assert_source_completions ss
|
21
test/lib/completions/ss.exp
Normal file
21
test/lib/completions/ss.exp
Normal file
@ -0,0 +1,21 @@
|
||||
proc setup {} {
|
||||
save_env
|
||||
}
|
||||
|
||||
|
||||
proc teardown {} {
|
||||
assert_env_unmodified
|
||||
}
|
||||
|
||||
|
||||
setup
|
||||
|
||||
|
||||
assert_complete_any "ss -"
|
||||
sync_after_int
|
||||
|
||||
assert_complete_any "ss -A "
|
||||
sync_after_int
|
||||
|
||||
|
||||
teardown
|
Loading…
x
Reference in New Issue
Block a user