Usage of $EDITOR and $VISUAL in a POSIX-compatible way
guardutil and guardlog can open an editor window. Determination of the editor to run follows this strategy:
- --editor commandline option
- EDITOR environment variable
- xdg-open
This is somewhat counter-intuitive and does not follow POSIX. A better order would be
- --editor commandline option, in case of failure
- xdg-open, in case of failure
- VISUAL environment variable, in case of failure
- EDITOR environment variable
Of course, the commandline option should always supersede any default setting. xdg-open tries to open a (potentially) nice graphical editor. If that fails, next fallback is POSIX defining the VISUAL (preffered as it should point to a screen-oriented editor) and EDITOR (for line-oriented editing) variables. Both EDITOR and VISUAL should be expected to be textmode applications, so we need to open a terminal (like "xterm -e") to run them. Alternatively (or even additionally), a configuration setting in /etc/guardian/local-env could be established (e.g., GUARD_EDITOR).