aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAyush Agarwal <ayush@fastmail.in>2021-11-14 12:54:07 +0530
committerAyush Agarwal <ayush@fastmail.in>2021-11-14 12:54:07 +0530
commit95111487107a063b00907f7c7dbc1289fcbd0513 (patch)
treea1f5a07abc5e5204435a2fb9405eab754362c5fc
parent0e1e98487e99914b15f253c5a8c9df6bb3adf4a2 (diff)
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.
-rwxr-xr-xtessen15
1 files changed, 12 insertions, 3 deletions
diff --git a/tessen b/tessen
index d04a5cc..0c46f3a 100755
--- 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=""