diff --git a/share/completions/scp.fish b/share/completions/scp.fish index 28c0d7572..8fe537218 100644 --- a/share/completions/scp.fish +++ b/share/completions/scp.fish @@ -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_(?\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"