Skip to content

Commit

Permalink
ssh-keygen: Make option parsing work with OpenSSH < 7
Browse files Browse the repository at this point in the history
OpenSSH 7.x:

usage: ssh-keygen [-q] [-b bits] [-t dsa | ecdsa | ed25519 | rsa | rsa1]
                  [-N new_passphrase] [-C comment] [-f output_keyfile]
       ssh-keygen -p [-P old_passphrase] [-N new_passphrase] [-f ...]

Earlier:

usage: ssh-keygen [options]
Options:
-A          Generate non-existent host keys for all key types.
-a number   Number of KDF rounds for new key format or ...
  • Loading branch information
scop committed Apr 18, 2017
1 parent 2abecdc commit 375bd17
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion completions/ssh-keygen
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ _ssh_keygen()
esac

if [[ $cur == -* ]]; then
COMPREPLY=( $( compgen -W '$( _parse_usage "$1" "-?" )' -- "$cur" ) )
local opts=$( _parse_usage "$1" "-?" )
[[ -z "$opts" ]] && opts=$( _parse_help "$1" "-?" ) # OpenSSH < 7
COMPREPLY=( $( compgen -W "$opts" -- "$cur" ) )
fi
} &&
complete -F _ssh_keygen ssh-keygen
Expand Down

0 comments on commit 375bd17

Please sign in to comment.