dotfiles/dot_config/fish/functions/cpkey.fish
punkfairie ce2a9538e8
Update .config/fish/conf.d/30-man.fish
Update .config/fish/functions/cpkey.fish
Update .config/packages/archgirlie
2024-09-29 21:32:44 -07:00

18 lines
617 B
Fish

#!/usr/bin/env fish
function cpkey -d "Copy the id_ed25519 public key to clipboard, generating the keypair if needed"
if ! [ -O "$HOME/.ssh/id_ed25519.pub" ]
echo "=> Generating id_ed25519 keypair..."
ssh-keygen -f "$HOME/.ssh/id_ed25519"
end
if command -v copyq &>/dev/null
more "$HOME/.ssh/id_ed25519.pub" | copyq copy -
else if command -v pbcopy &>/dev/null
more "$HOME/.ssh/id_ed25519.pub" | pbcopy
else
echo "=> Unsupported OS - please add your copy command to this script :)"
return 1
end
echo "=> Public key copied to clipbard"
end