standardize ssh completion scheme:
- complete after previous unstacked short options - complete potential options after dash - complete on known host if neither apply
This commit is contained in:
parent
8175d23c0d
commit
d8bb766fbe
26
contrib/ssh
26
contrib/ssh
@ -17,18 +17,29 @@ _ssh()
|
||||
case "$prev" in
|
||||
-F)
|
||||
_filedir
|
||||
return 0
|
||||
;;
|
||||
-*c)
|
||||
-c)
|
||||
COMPREPLY=( $( compgen -W 'blowfish 3des 3des-cbc blowfish-cbc \
|
||||
arcfour cast128-cbc' -- $cur ) )
|
||||
return 0
|
||||
;;
|
||||
-*i)
|
||||
-i)
|
||||
_filedir
|
||||
return 0
|
||||
;;
|
||||
-*l)
|
||||
-l)
|
||||
COMPREPLY=( $( compgen -u -- $cur ) )
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
esac
|
||||
|
||||
if [[ "$cur" == -* ]]; then
|
||||
COMPREPLY=( $( compgen -W '-1 -2 -4 -6 -A -a -C -f -g -K -k -M \
|
||||
-N -n -q -s -T -t -V -v -X -v -Y -y -b -b -c -D -e -F \
|
||||
-i -L -l -m -O -o -p -R -S -w' -- $cur ) )
|
||||
else
|
||||
if [ $COMP_CWORD -eq 1 ]; then
|
||||
# Search COMP_WORDS for '-F configfile' argument
|
||||
set -- "${COMP_WORDS[@]}"
|
||||
while [ $# -gt 0 ]; do
|
||||
@ -43,12 +54,11 @@ _ssh()
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
_known_hosts -a "$optconfigfile"
|
||||
|
||||
[ $COMP_CWORD -eq 1 -o -n "$optconfigfile" ] || \
|
||||
else
|
||||
COMPREPLY=( "${COMPREPLY[@]}" $( compgen -c -- $cur ) )
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user