Subject: | defaults should be able to leverage $ENV |
Hi, I've committed some perl evil to get Euclid to allow defaulting to
environment variables.
I do it like this:
=item -core <core>
directory where core path is.
=for Euclid:
core.default: "@{[$ENV{CORE}]}"
core.type: /^\/\w\w\w/
The intention here is to set core's path to $ENV{CORE} if it's not
supplied.
There are 2 issues with my current approach.
1. Non-intuitive errors occur when -core is not fed on command line and
$ENV{CORE} is not defined
2. even if -core is fed on the command line and $ENV{CORE} is not
defined, I get an error complaining that -core was fed an invalid
regex. the regex for default seems to be parsing the default even if
default is not used.
It seems like there should be a better approach to this problem and it
seems like this is a feature many would desire.
How about something like this that would be checked if it is not
defined on command line, before going to core.default?
=for Euclid:
core.env_var_default: CORE
core.type: /^\/\w\w\w/