diff options
author | Ayush Agarwal <ayush@fastmail.in> | 2022-02-18 22:32:50 +0530 |
---|---|---|
committer | Ayush Agarwal <ayush@fastmail.in> | 2022-02-18 22:32:50 +0530 |
commit | 2a591c590b0799f64a8492bfb24b73f05f89db3a (patch) | |
tree | f76f4373892dc95cee58d8dbb67027db87f30b6c /tessen | |
parent | 16118c46c5747488f7a9507ec5d7abbfe43013fa (diff) |
fix: set default values after argparse and config
Diffstat (limited to 'tessen')
-rwxr-xr-x | tessen | 33 |
1 files changed, 17 insertions, 16 deletions
@@ -745,22 +745,8 @@ parse_config() { } main() { - # initialize basic options for users who expect sane defaults and don't use - # either the config file or args - if [[ -z $pass_backend ]]; then - find_pass_backend - fi - if [[ -z $dmenu_backend ]]; then - find_dmenu_backend - fi - validate_dmenu_backend "$dmenu_backend" - validate_action default - - # parse the config file - parse_config "$@" - - # parse command line arguments after the config file because args hold more - # precedence and priority than the config file + # parse arguments because they have the highest priority + # make the values supplied to -p, -d, and -a as readonly local _opt while [[ $# -gt 0 ]]; do _opt="$1" @@ -865,6 +851,21 @@ main() { readonly dmenu_backend_opts fi + # initialize basic options for users who expect sane defaults and don't use + # either the config file or args + if [[ -z $pass_backend ]]; then + find_pass_backend + readonly pass_backend + fi + if [[ -z $dmenu_backend ]]; then + find_dmenu_backend + validate_dmenu_backend "$dmenu_backend" + readonly dmenu_backend + fi + if [[ -z $tsn_action ]]; then + validate_action default + fi + trap '_clear' EXIT TERM INT if [[ $pass_backend == "pass" ]]; then get_pass_files |