Skip to content

Commit 5c1d270

Browse files
committed
feat(ssh-copy-id,ssh-keygen): prefer ssh from same dir
1 parent 473278f commit 5c1d270

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

completions/ssh-copy-id

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ _comp_cmd_ssh_copy_id()
55
local cur prev words cword comp_args
66
_comp_initialize -- "$@" || return
77

8+
# Prefer `ssh` from same dir for resolving options, etc
9+
local pathcmd
10+
pathcmd=$(type -P "$1") && local PATH=${pathcmd%/*}:$PATH
11+
812
_comp_xfunc ssh suboption_check && return
913

1014
case $prev in

completions/ssh-keygen

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ _comp_cmd_ssh_keygen()
9999
return
100100
;;
101101
-*t)
102+
# Prefer `ssh` from same dir for resolving options, etc
103+
local pathcmd
104+
pathcmd=$(type -P "$1") && local PATH=${pathcmd%/*}:$PATH
102105
local protocols=$(_comp_xfunc ssh query protocol-version)
103106
local types='dsa ecdsa ecdsa-sk ed25519 ed25519-sk rsa'
104107
if [[ $protocols == *1* ]]; then

0 commit comments

Comments
 (0)