about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAoi Koizumi <novaburst@kalli.st>2022-05-07 13:13:28 -0300
committerAoi Koizumi <novaburst@kalli.st>2022-05-07 13:13:28 -0300
commitea06da326231adc9c2e2dc88db54b5100c608867 (patch)
tree170e97e4be28baa4e1cd3a9bff6698170d2cd0b2
parentfcc0f94031db0b83ba9b2cd85b4b678f6c3f2d5b (diff)
downloadayu-ea06da326231adc9c2e2dc88db54b5100c608867.tar.gz
Added aliases for subcommands, update manual page and added a new environment variable.
Signed-off-by: Aoi Koizumi <novaburst@kalli.st>
-rw-r--r--ayu19
-rw-r--r--ayu.mdoc35
2 files changed, 27 insertions, 27 deletions
diff --git a/ayu b/ayu
index fe50472..26287b3 100644
--- a/ayu
+++ b/ayu
@@ -20,6 +20,7 @@ if ! test -f "$ayu_settings"/config; then
     cat << EOF > "$ayu_settings"/config
 #ayu_clipboard=$(wl-copy --primary)
 #ayu_clipboard=$(xsel -ib)
+ayu_editor=${ayu_editor:-vi}
 ayu_private_key=${ayu_dir}/private_key
 ayu_public_key=${ayu_dir}/public_key
 EOF
@@ -38,7 +39,7 @@ fn_copy() {
 }
 fn_edit() {
     age --decrypt --identity="${ayu_private_key}" --output="${1%%.age}" "${1%%.age}.age"
-    $EDITOR "${1%%.age}"
+    ${ayu_editor} "${1%%.age}"
     age --encrypt --recipients-file "${ayu_public_key}" --output="${1%%.age}.age" "${1%%.age}"
     rm "${1%%.age}"
 }
@@ -49,7 +50,7 @@ fn_new() {
     test -d "$1" && fn_usage && exit
 
     tmpfile="$(mktemp)"
-    ${EDITOR} "$tmpfile"
+    ${ayu_editor} "$tmpfile"
 
     mkdir -p "$(dirname "$1")"
     age --encrypt --recipients-file "${ayu_public_key}" --output="$tmpfile.age" "$tmpfile"
@@ -80,12 +81,12 @@ fn_view() {
 
 ## Command line parsing (I don't get why this has be so difficult for say, Lua)
 case $1 in
-    -c) fn_copy "$2" ;;
-    -e) fn_edit "$2" ;;
-    -l) fn_list ;;
-    -n) fn_new "$2" ;;
-    -r) fn_remove_single "$2" ;;
-    -R) fn_remove_recursive "$2" ;;
-    -v) fn_view "$2" ;;
+    -c | copy) fn_copy "$2" ;;
+    -e | edit) fn_edit "$2" ;;
+    -l | list) fn_list ;;
+    -n | add) fn_new "$2" ;;
+    -r | del) fn_remove_single "$2" ;;
+    -R | delr) fn_remove_recursive "$2" ;;
+    -v | view) fn_view "$2" ;;
     *) fn_usage ;;
 esac
diff --git a/ayu.mdoc b/ayu.mdoc
index b5d75d4..9f32b61 100644
--- a/ayu.mdoc
+++ b/ayu.mdoc
@@ -1,4 +1,4 @@
-.Dd March 23, 2022
+.Dd May 7, 2022
 .Dt ayu 1
 .Os
 .Sh NAME
@@ -9,7 +9,7 @@ My own take with password managers, this one uses
 .Xr age 1
 as backend, instead of 
 .Xr gpg 1
-for encryption
+for encryption.
 .Pp
 This program is generally stable by now, and can be used as replacement to either
 .Xr angou 1
@@ -24,19 +24,19 @@ but there's already a Go variant using age's library.
 So it's not like I'm gonna care.
 .Sh USAGE
 .Bl -tag -width 11n -compact
-.It -n
+.It add, -n
 Add a new entry
-.It -c
+.It copy, -c
 Copy an entry's text to the clipboard
-.It -e
+.It edit, -e
 Edit an entry
-.It -l
+.It list, -l
 List all entries
-.It -r
+.It del, -r
 Remove single entries
-.It -R
+.It delr, -R
 Remove recursively a directory w/ entries
-.It -v
+.It view, -v
 View an entry
 .Bl
 .Sh CAVEATS
@@ -49,17 +49,16 @@ and the public key to
 .Em ~/.ayu/public_key
 for the utility to work
 .Sh ENVIRONMENT VARIABLES
-.Ev Sy $ayu_dir
+.Bl -tag -width 11n -compact
+.It Ev Sy $ayu_clipboard
+Clipboard program to be used
+.It Ev Sy $ayu_dir
 Runtime directory
-.Pp
-.Ev Sy $ayu_store
+.It Ev Sy $ayu_editor
+Default editor used by this program
+.It Ev Sy $ayu_store
 Password store
-.Pp
-.Ev Sy $ayu_clipboard
-Clipboard program to be used.
-Defaults to
-.Xr xclip 1
-.Pp
+.El
 .Sh SEE ALSO
 .Xr age 1
 .Xr age-keygen 1