From 070094c8819d646dea4fa8e8b8659f54b54a52de Mon Sep 17 00:00:00 2001 From: GrĂ©goire DuchĂȘne Date: Sat, 19 Dec 2020 15:59:28 +0000 Subject: zsh: Add a vault command --- zsh/functions/_vault | 3 +++ zsh/functions/vault | 14 ++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 zsh/functions/_vault create mode 100644 zsh/functions/vault (limited to 'zsh/functions') diff --git a/zsh/functions/_vault b/zsh/functions/_vault new file mode 100644 index 0000000..5cab4e5 --- /dev/null +++ b/zsh/functions/_vault @@ -0,0 +1,3 @@ +#compdef vault + +_arguments ": :(close open)" ": :_path_files" diff --git a/zsh/functions/vault b/zsh/functions/vault new file mode 100644 index 0000000..abe0158 --- /dev/null +++ b/zsh/functions/vault @@ -0,0 +1,14 @@ +# -*- mode: sh -*- + +case $1 in + close) + hdiutil unmount -quiet $2 + ;; + open) + op get item ${2:t} --fields password --session $(op signin --raw) \ + | hdiutil attach -quiet -stdinpass $2 + ;; + *) + return 1 + ;; +esac -- cgit v1.2.3-70-g09d2