mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +00:00
scp completions: fix path escaping
This commit is contained in:
parent
7b5667b11f
commit
f6123d235c
1 changed files with 16 additions and 12 deletions
|
@ -37,26 +37,30 @@ end
|
|||
# scp specific completions
|
||||
#
|
||||
|
||||
#
|
||||
# Inherit user/host completions from ssh
|
||||
#
|
||||
complete -c scp -d Remote -n "__fish_no_scp_remote_specified; and not string match -e : (commandline -ct)" -a "(complete -C'ssh ' | string replace -r '\t.*' ':')"
|
||||
|
||||
#
|
||||
# Local path
|
||||
#
|
||||
complete -c scp -d "Local Path" -n "not string match @ -- (commandline -ct)"
|
||||
|
||||
#
|
||||
# Remote path
|
||||
#
|
||||
# Get the list of remote files from the scp target.
|
||||
complete -c scp -d "Remote Path" -f -n "commandline -ct | string match -e ':'" -a "
|
||||
(__scp_remote_target):( \
|
||||
command ssh (__scp2ssh_port_number) -o 'BatchMode yes' (__scp_remote_target) command\ ls\ -dp\ (__scp_remote_path_prefix | string unescape)\* 2>/dev/null |
|
||||
string escape -n
|
||||
)
|
||||
"
|
||||
string match -rq 'OpenSSH_(?<major>\d+)\.*' -- (ssh -V 2>&1)
|
||||
if test "$major" -ge 9
|
||||
complete -c scp -d "Remote Path" -f -n "commandline -ct | string match -e ':'" -a "
|
||||
(__scp_remote_target):( \
|
||||
command ssh (__scp2ssh_port_number) -o 'BatchMode yes' (__scp_remote_target) command\ ls\ -dp\ (__scp_remote_path_prefix)\* 2>/dev/null
|
||||
)
|
||||
"
|
||||
else
|
||||
complete -c scp -d "Remote Path" -f -n "commandline -ct | string match -e ':'" -a "
|
||||
(__scp_remote_target):( \
|
||||
command ssh (__scp2ssh_port_number) -o 'BatchMode yes' (__scp_remote_target) command\ ls\ -dp\ (__scp_remote_path_prefix | string unescape)\* 2>/dev/null |
|
||||
string escape -n
|
||||
)
|
||||
"
|
||||
end
|
||||
|
||||
complete -c scp -s 3 -d "Copies between two remote hosts are transferred through the local host"
|
||||
complete -c scp -s B -d "Batch mode"
|
||||
complete -c scp -s D -x -d "Connect directly to a local SFTP server"
|
||||
|
|
Loading…
Reference in a new issue