From c688f8ce00149244519519e6fdcd61a2a1dac4ce Mon Sep 17 00:00:00 2001 From: Ian Fijolek Date: Thu, 22 Jul 2021 12:01:26 -0700 Subject: [PATCH] Add support for a couple other clipboard tools to helper script --- scripts/yk.fish | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/yk.fish b/scripts/yk.fish index ae39e15..1bcb610 100644 --- a/scripts/yk.fish +++ b/scripts/yk.fish @@ -6,5 +6,15 @@ complete -c yk -a set-password -d "Set authentication password" complete -c yk -a "(yk list)" -d "Credential to get TOTP for" function yk-copy --description "Select a credential using fzf and copy it to clipboard" - yk (yk list | fzf) | pbcopy + set result (yk (yk list | fzf)) + + if command -q pbcopy + echo "$result" | pbcopy + else if command -q xsel + echo "$result" | xsel --clipboard + else if command -q xclip + echo "$result" | xclip + else + echo "No clipboard command found. Code is $result" + end end