Simplify ssh-sign() a bit
This commit is contained in:
parent
5a4e65a545
commit
56fd3d07a8
|
@ -1,6 +1,6 @@
|
|||
#compdef ssh-sign
|
||||
|
||||
_arguments '-f[key file]:filename:_files' '-n[namespace]:namespace:_ssh-sign_namespaces' '*:file:_files' '-h[short help text]'
|
||||
_arguments '-f[key file]:filename:_files' '-n[namespace]:namespace:_ssh-sign_namespaces' '-h[short help text]' '*:file:_files'
|
||||
|
||||
function _ssh-sign_namespaces()
|
||||
{
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
setopt LOCAL_OPTIONS ERR_RETURN NO_UNSET PIPE_FAIL
|
||||
|
||||
zmodload zsh/zutil
|
||||
local -a keyfile=(-f ~/.ssh/id_ed25519)
|
||||
local -a namespace=(-n file)
|
||||
local -a help=()
|
||||
zparseopts -D -K -- f:=keyfile n:=namespace h=help
|
||||
if [[ ${#help} -ne 0 ]]; then
|
||||
print "Usage: ${0} [-h] [-f KEYFILE] [-n NAMESPACE] <file> …"
|
||||
local -a o_keyfile=(-f ~/.ssh/id_ed25519)
|
||||
local -a o_namespace=(-n file)
|
||||
local -a o_help=()
|
||||
zparseopts -D -K -- f:=o_keyfile n:=o_namespace h=o_help
|
||||
if [[ ${#o_help} -ne 0 ]]; then
|
||||
print "usage: ${0} [-h] [-f KEYFILE] [-n NAMESPACE] <FILE> …"
|
||||
return 0
|
||||
fi
|
||||
|
||||
ssh-keygen -Y sign -f ${keyfile[2]} -n ${namespace[2]} ${@}
|
||||
ssh-keygen -Y sign ${o_keyfile} ${o_namespace} ${@}
|
||||
|
|
Loading…
Reference in New Issue