ssh, scp, sftp, ssh-copy-id: Use _parse_help/_parse_usage, add some option argument (non)completions.
This commit is contained in:
parent
2e4d73ff6c
commit
68f7fa16b0
@ -152,6 +152,9 @@ _ssh()
|
|||||||
_ssh_bindaddress
|
_ssh_bindaddress
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
|
-D|-e|-I|-L|-O|-p|-R|-W)
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ "$cur" == -F* ]]; then
|
if [[ "$cur" == -F* ]]; then
|
||||||
@ -161,9 +164,7 @@ _ssh()
|
|||||||
COMPREPLY=( "${COMPREPLY[@]/#/-F}" )
|
COMPREPLY=( "${COMPREPLY[@]/#/-F}" )
|
||||||
cur=-F$cur # Restore cur
|
cur=-F$cur # Restore cur
|
||||||
elif [[ "$cur" == -* ]]; then
|
elif [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '-1 -2 -4 -6 -A -a -C -f -g -K -k -M \
|
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
|
||||||
-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
|
else
|
||||||
# Search COMP_WORDS for '-F configfile' or '-Fconfigfile' argument
|
# Search COMP_WORDS for '-F configfile' or '-Fconfigfile' argument
|
||||||
set -- "${words[@]}"
|
set -- "${words[@]}"
|
||||||
@ -202,7 +203,7 @@ _sftp()
|
|||||||
_ssh_suboption_check && return 0
|
_ssh_suboption_check && return 0
|
||||||
|
|
||||||
case $prev in
|
case $prev in
|
||||||
-b|-F|-P)
|
-b|-F|-i)
|
||||||
_filedir
|
_filedir
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
@ -210,6 +211,13 @@ _sftp()
|
|||||||
_ssh_options
|
_ssh_options
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
|
-c)
|
||||||
|
_ssh_ciphers
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
|
-B|-D|-P|-R|-S|-s)
|
||||||
|
return 0
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ "$cur" == -F* ]]; then
|
if [[ "$cur" == -F* ]]; then
|
||||||
@ -219,8 +227,7 @@ _sftp()
|
|||||||
COMPREPLY=( "${COMPREPLY[@]/#/-F}" )
|
COMPREPLY=( "${COMPREPLY[@]/#/-F}" )
|
||||||
cur=-F$cur # Restore cur
|
cur=-F$cur # Restore cur
|
||||||
elif [[ "$cur" == -* ]]; then
|
elif [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '-1 -C -v -B -b -F -o -P -R -S -s' \
|
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" )' -- "$cur" ) )
|
||||||
-- "$cur" ) )
|
|
||||||
else
|
else
|
||||||
# Search COMP_WORDS for '-F configfile' argument
|
# Search COMP_WORDS for '-F configfile' argument
|
||||||
set -- "${words[@]}"
|
set -- "${words[@]}"
|
||||||
@ -369,8 +376,8 @@ _scp()
|
|||||||
|
|
||||||
case $cur in
|
case $cur in
|
||||||
-*)
|
-*)
|
||||||
COMPREPLY=( $( compgen -W '-1 -2 -4 -6 -B -C -c -F -i -l -o \
|
COMPREPLY=( $( compgen -W '$( _parse_usage "${words[0]}" )' \
|
||||||
-P -p -q -r -S -v' -- "$cur" ) )
|
-- "$cur" ) )
|
||||||
COMPREPLY=( "${COMPREPLY[@]/%/ }" )
|
COMPREPLY=( "${COMPREPLY[@]/%/ }" )
|
||||||
return 0
|
return 0
|
||||||
;;
|
;;
|
||||||
@ -404,7 +411,7 @@ _ssh_copy_id()
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ "$cur" == -* ]]; then
|
if [[ "$cur" == -* ]]; then
|
||||||
COMPREPLY=( $( compgen -W '-i' -- "$cur" ) )
|
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" --help )' -- "$cur" ) )
|
||||||
else
|
else
|
||||||
_known_hosts_real -a "$cur"
|
_known_hosts_real -a "$cur"
|
||||||
fi
|
fi
|
||||||
|
Loading…
x
Reference in New Issue
Block a user