Allow job descriptions (*.jr) to override Jobrnr options
rfdonnelly opened this issue · comments
Determine options in the following manner
- Load default value
- Get value from environment variable
- Get value from command line options before dot-jr
jobrnr <options-before-dot-jr> dot-jr.jr
- Get value from dot-jr
- Get value from command line options after job description
jobrnr dot-jr.jr <options-after-dot-jr>
TODO
- Load default value
- Get value from environment variable
- Get value from command line options before dot-jr
- Get value from dot-jr
- Get value from command line options after dot-jr
- Document behavior
Example
--max-jobs
default is 1
dot-jr.jr:
options.max_jobs = 4
command line:
JOBRNR_MAX_JOBS=2 jobrnr --max-jobs 3 dot-jr.jr --max-jobs 5
Initial value for the --max-jobs option is 1 (default). It gets overridden by environment variable to 2. The overridden by --max-jobs option on command line to 3. Then overriden by dot-jr.jr to 4. Finally overridden to 5 by another --max-jobs option on the command line.
Might be able to use OptionParser::order
to implement command-line option override of options specified in the job description (*.jr).
OptionParser::order
is not viable since we need all plus options after the script on the command-line before we evaluate the script.
Instead, the solution will be to manually partition the args into pre-args and post-args then parse the pre-args, evaluate the user script, and lastly parse the post-args.