scp should have completion too
parent
563385b6a1
commit
d85b6e67f0
|
|
@ -11,7 +11,7 @@ _sshcomplete() {
|
||||||
local OPTIONS=" -- ${CURRENT_PROMPT}"
|
local OPTIONS=" -- ${CURRENT_PROMPT}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# parse all defined hosts from .ssh/config
|
# parse all defined hosts from .ssh/config
|
||||||
if [ -r "$HOME/.ssh/config" ]; then
|
if [ -r "$HOME/.ssh/config" ]; then
|
||||||
COMPREPLY=($(compgen -W "$(grep ^Host "$HOME/.ssh/config" | awk '{for (i=2; i<=NF; i++) print $i}' )" ${OPTIONS}) )
|
COMPREPLY=($(compgen -W "$(grep ^Host "$HOME/.ssh/config" | awk '{for (i=2; i<=NF; i++) print $i}' )" ${OPTIONS}) )
|
||||||
|
|
@ -28,9 +28,8 @@ _sshcomplete() {
|
||||||
if [ -r /etc/hosts ]; then
|
if [ -r /etc/hosts ]; then
|
||||||
COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$( grep -v '^[[:space:]]*$' /etc/hosts | grep -v '^#' | awk '{for (i=2; i<=NF; i++) print $i}' )" ${OPTIONS}) )
|
COMPREPLY=( ${COMPREPLY[@]} $(compgen -W "$( grep -v '^[[:space:]]*$' /etc/hosts | grep -v '^#' | awk '{for (i=2; i<=NF; i++) print $i}' )" ${OPTIONS}) )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
complete -o default -o nospace -F _sshcomplete ssh
|
complete -o default -o nospace -F _sshcomplete ssh scp
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue