logo

secret

Replacement to pass(1) based on reop(1)
commit: 08466cf3aa2e2d8140353a418dd52151bca8a4fa
parent: 5258be221145a6b3a8128766c455234214ff9c99
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Sun, 24 May 2020 17:29:43 +0200

secret: Add edit command

Diffstat:

Msecret14++++++++++++++
1 file changed, 14 insertions(+), 0 deletions(-)

diff --git a/secret b/secret @@ -61,6 +61,17 @@ secret_read_oath() { oathtool --totp --base32 "$secret" } +secret_edit() { + file=/tmp/secret."$RANDOM".txt + unset SECRET_FILE + + secret_read "$@" > "$file" + + $EDITOR "$file" || rm "$file" + + secret_write "$@" < "$file" ; rm "$file" +} + secret_dmenu() { echo | dmenu -nb '#000' -nf '#000' -p "Passphrase: " } @@ -91,6 +102,8 @@ secret read <entry> Read a secret entry. secret write <entry> Write a secret entry. +secret edit <entry> + Wrapper around $EDITOR for easy secret edition. secret dmenu dmenu on entries, dmenu for a passphrase, read secret, pipe to xclip(1). @@ -115,6 +128,7 @@ case "$command" in tree) secret_tree "$@" ;; read) secret_read "$@" ;; write) secret_write "$@" ;; + edit) secret_edit "$@" ;; dmenu) secret_dmenu_read "$@" ;; ls-oath) secret_list_oath "$@" ;;