WIP: New config hierarchy
Change config file hierarchy and read order
Previously, the hierarchy was:
- Local config
w3_config_hook
- Global config
While in the read order, 3 and 1 were swapped. This made for some
annoyances when using surfraw
in scripts.
Now, the hierarchy is as follows:
- Pre-existing environment variables
- Local config
w3_config_hook
- Global config
The read order is the same as the hierarchy and code should use the
def*
family of functions instead of setting variables directly.
Now calls like the following can work:
$ export SURFRAW_graphical=yes
$ surfraw foo bar
$ surfraw foo baz
Which will open both calls in the graphical browser.
This would propagate to scripts that call surfraw
, thus making their
use easier as no environment variables like SURFRAW_FLAGS
have to be
introduced and supported in every script.
There have been attempts at backwards compatibility. New-style (i.e. files named "config") take precedence, but fall back on the old behaviour ("conf") if not present.