summaryrefslogtreecommitdiff
path: root/tessen
diff options
context:
space:
mode:
authorAyush Agarwal <ayush@fastmail.in>2021-09-08 01:02:47 +0530
committerAyush Agarwal <ayush@fastmail.in>2021-09-08 01:02:47 +0530
commit4c60341519bc0471b07a049143400cc2112c83c6 (patch)
tree877ff6a4a09bcf52b445dfc78127a0c89cdd2e45 /tessen
parent19ad5f90a1a696b8e7b8bf62fce0176852230809 (diff)
add trap and reorganize global vars
Diffstat (limited to 'tessen')
-rwxr-xr-xtessen19
1 files changed, 9 insertions, 10 deletions
diff --git a/tessen b/tessen
index 2dda3b6..9e12b11 100755
--- a/tessen
+++ b/tessen
@@ -7,20 +7,13 @@ readonly PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
export PATH
umask 077
+# initialize the global variables
BACKEND="bemenu"
CLIP_TIME=15
WTYPE=""
-
-
-readonly CLIP_TIME
-readonly BACKEND
-readonly WTYPE
-
-
-# initialize the primary global variables
readonly PASS_STORE="${PASSWORD_STORE_DIR:-$HOME/.password-store}"
-PASSFILE="" # password file chosen by the user for decryption
-declare -A PASSDATA_ARR # decrypted password-store data except the password
+PASSFILE=""
+declare -A PASSDATA_ARR
USERNAME=""
PASSWORD=""
CHOICE=""
@@ -241,9 +234,14 @@ main() {
unset -v opt
shift $((OPTIND - 1))
+ readonly WTYPE
+ readonly BACKEND
+ readonly CLIP_TIME
+
validate_backend
validate_clip_time
+ trap 'die' EXIT TERM
get_pass_file
get_pass_data
@@ -254,6 +252,7 @@ main() {
choice_data_copy
key_menu_copy
fi
+ trap - EXIT TERM
}
main "$@"