Skip to content

Commit

Permalink
feat(ssh-copy-id,ssh-keygen): prefer ssh from same dir
Browse files Browse the repository at this point in the history
  • Loading branch information
scop committed May 22, 2023
1 parent 473278f commit 5c1d270
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions completions/ssh-copy-id
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ _comp_cmd_ssh_copy_id()
local cur prev words cword comp_args
_comp_initialize -- "$@" || return

# Prefer `ssh` from same dir for resolving options, etc
local pathcmd
pathcmd=$(type -P "$1") && local PATH=${pathcmd%/*}:$PATH

_comp_xfunc ssh suboption_check && return

case $prev in
Expand Down
3 changes: 3 additions & 0 deletions completions/ssh-keygen
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ _comp_cmd_ssh_keygen()
return
;;
-*t)
# Prefer `ssh` from same dir for resolving options, etc
local pathcmd
pathcmd=$(type -P "$1") && local PATH=${pathcmd%/*}:$PATH
local protocols=$(_comp_xfunc ssh query protocol-version)
local types='dsa ecdsa ecdsa-sk ed25519 ed25519-sk rsa'
if [[ $protocols == *1* ]]; then
Expand Down

0 comments on commit 5c1d270

Please sign in to comment.