commit 95111487107a063b00907f7c7dbc1289fcbd0513
parent 0e1e98487e99914b15f253c5a8c9df6bb3adf4a2
Author: Ayush Agarwal <ayush@fastmail.in>
Date: Sun, 14 Nov 2021 12:54:07 +0530
feat: add global variables for more features
The TESSEN_USERKEY environment variable can be set to point tessen to a
custom key which should be considered as the username.
The TESSEN_URLKEY environment variable can be set to point tessen to a
custom key which should be considered as the URL of website.
The TESSEN_AUTOKEY environment variable can be set to point tessen to a
custom key which should be considered for custom auto type operations
instead of the default operation of auto typing the username and the
password.
The TESSEN_DELAY environment variable can be set to make tessen
introduce delay when auto typing to avoid errors. The default is 200
milliseconds.
'bemenu' is no longer the default backend.
Diffstat:
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/tessen b/tessen
@@ -8,13 +8,22 @@
# don't leak password data if debug mode is enabled
set +x
-# initialize the global variables
+# GLOBAL VARIABLES
+# variables which won't be changed and can be made readonly
readonly tsn_version="1.1.2"
readonly tsn_prefix="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
readonly tsn_cliptime="${PASSWORD_STORE_CLIP_TIME:-15}"
-tsn_backend="${TESSEN_BACKEND:-bemenu}" # uses the value of TESSEN_BACKEND if set by user
+readonly tsn_delay="${TESSEN_DELAY:-200}"
+# variables which hold data for possible actions and choices
+tsn_backend="${TESSEN_BACKEND-}"
tsn_backend_opts=""
-tsn_action="${TESSEN_ACTION-}" # uses the value of TESSEN_ACTION if set by user
+tsn_action="${TESSEN_ACTION-}"
+tsn_userkey="${TESSEN_USERKEY:-user}"
+tsn_urlkey="${TESSEN_URLKEY:-url}"
+tsn_autokey="${TESSEN_AUTOKEY:-autotype}"
+tsn_autotype=""
+tsn_otp=false
+# variables with sensitive data which will be manually unset using _clear
tsn_passfile=""
declare -A tsn_passdata
tsn_username=""