summaryrefslogtreecommitdiff
path: root/zsh
diff options
context:
space:
mode:
authorGrégoire Duchêne <gduchene@awhk.org>2021-03-19 18:54:35 +0000
committerGrégoire Duchêne <gduchene@awhk.org>2021-03-19 18:54:35 +0000
commit25a171180abc71dce9632d98cb8985d84c3e0e0e (patch)
treecdf052d276fe43f4e65d045a556c542d0c9cf009 /zsh
parent8952c012690b4b330963f344fb2ad0bd73b963ce (diff)
zsh/op-ssh-add: Do not drop arguments
Diffstat (limited to 'zsh')
-rw-r--r--zsh/functions/op-ssh-add7
1 files changed, 5 insertions, 2 deletions
diff --git a/zsh/functions/op-ssh-add b/zsh/functions/op-ssh-add
index 90cff9a..2e7fc68 100644
--- a/zsh/functions/op-ssh-add
+++ b/zsh/functions/op-ssh-add
@@ -16,11 +16,14 @@ if [[ ${@[1]} =~ '-[DdKLlTXx]' ]]; then
return $?
fi
-local fp prv pub
+local args=$@ fp prv pub
for prv (${@[-1]} ~/.ssh/id_{ecdsa,ed25519}{,_sk}); do
if [[ -f ${prv}.pub ]]; then
pub=${prv}.pub
fp=$(cut -d' ' -f2 <<< $(ssh-keygen -f ${pub} -l))
+ if [[ ${prv} != ${@[-1]} ]]; then
+ args+=(${prv})
+ fi
break
fi
done
@@ -36,7 +39,7 @@ if [[ -z ${session} ]]; then
fi
zmodload zsh/zpty
-zpty ssh $(which -p ssh-add) ${prv}
+zpty ssh $(which -p ssh-add) ${args}
_cleanup() {
zpty -d ssh