about summary refs log tree commit diff stats
path: root/ayu
diff options
context:
space:
mode:
authorNova li Gensokyo <novaburst@kalli.st>2021-12-06 22:04:11 +0000
committerNova li Gensokyo <novaburst@kalli.st>2021-12-06 22:04:11 +0000
commit87c338bdc19245c97260c940e7349cfff9948754 (patch)
tree86a9ef11e7bf2931eae4ee29f8d182f31fff670e /ayu
parente7eeaeacd280d6cc77d49bd2f4f21b9abdaf79c9 (diff)
downloadayu-87c338bdc19245c97260c940e7349cfff9948754.tar.gz
I'm pulling *something* here. - Dom Marotta
Diffstat (limited to 'ayu')
-rwxr-xr-xayu13
1 files changed, 8 insertions, 5 deletions
diff --git a/ayu b/ayu
index a4e9dcd..ffd51e1 100755
--- a/ayu
+++ b/ayu
@@ -1,14 +1,18 @@
 #!/bin/sh
 
+# ayu(1) - an actually boring password manager, which uses age(1) as backend.
+
 # Path to the program's directory
 ayu_dir="$HOME/.config/ayu"
 
+# Path to the password store
+ayu_store="$HOME/.ayu"
+
 # Path to the age(1) keys
 ayu_key="$ayu_dir/age.key"
 ayu_pub="$ayu_store/.age-id"
 
-# Path to the password store
-ayu_store="$HOME/.ayu"
+EDITOR=${EDITOR:-vi}
 
 test -d $ayu_dir || mkdir -p $ayu_dir
 test -d $ayu_store || mkdir -p $ayu_store
@@ -20,11 +24,10 @@ if ! [ -f $ayu_key ];then
 	exit 1
 fi
 
-cd $ayu_store
 
 edit() {
 	age --decrypt --identity=$ayu_key --output=${1%%.age} ${1%%.age}.age
-	vi ${1%%.age}
+	${EDITOR} ${1%%.age}
 	age --encrypt -R $ayu_pub --output=${1%%.age}.age ${1%%.age}
 	rm ${1%%.age}
 }
@@ -37,7 +40,7 @@ new() {
 	test -d "$1" && usage && exit
 
 	tmpfile="$(mktemp)"
-	vi "$tmpfile"
+	${EDITOR} "$tmpfile"
 
 	mkdir -p "$(dirname "$1")"
 	age --encrypt -R $ayu_pub -o $tmpfile.age $tmpfile