fix: Parse EDITOR and VISUAL env vars with lower precedence
Since the precedence now goes (from lowest to highest): defaults -> conf_file -> env -> cli existing EDITOR or VISUAL variables would overwrite those explicitly set in the conf file. While we do want the general precedence of env over conf file, this is a special case where we get the value of the _DEFAULT_ variable from the env, and only then start parsing our own options. So now, for these vars we do: default -> env (EDITOR/VISUAL) -> conf_file -> env (TOPEN_EDITOR) -> cli
This commit is contained in:
parent
96422d254b
commit
3fded7315c
1 changed files with 2 additions and 2 deletions
4
topen.py
4
topen.py
|
|
@ -22,7 +22,7 @@ DEFAULTS_DICT = {
|
|||
"notes_dir": "~/.local/share/task/notes",
|
||||
"notes_ext": "md",
|
||||
"notes_annot": "Note",
|
||||
"notes_editor": "nano",
|
||||
"notes_editor": os.getenv("EDITOR") or os.getenv("VISUAL") or "nano",
|
||||
"notes_quiet": "False",
|
||||
}
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ def parse_env() -> dict:
|
|||
"notes_dir": os.getenv("TOPEN_DIR"),
|
||||
"notes_ext": os.getenv("TOPEN_EXT"),
|
||||
"notes_annot": os.getenv("TOPEN_ANNOT"),
|
||||
"notes_editor": os.getenv("TOPEN_EDITOR") or os.getenv("EDITOR") or os.getenv("VISUAL"),
|
||||
"notes_editor": os.getenv("TOPEN_EDITOR"),
|
||||
"notes_quiet": os.getenv("TOPEN_QUIET"),
|
||||
}
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue