dotfiles/.config/zsh/functions/ssh-sign

17 lines
431 B
Bash
Executable File

#!/usr/bin/env zsh
# Sign files with SSH
setopt LOCAL_OPTIONS ERR_RETURN NO_UNSET PIPE_FAIL
zmodload zsh/zutil
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 ${o_keyfile} ${o_namespace} ${@}