Repository navigation
Replies: 4 comments 2 replies
|
Oh you're correct it have changed!
When introducing that option the config file is sourced after the the CLI options and overriding them. For now, what you could do is shuck a |
|
So I've tried to wrap my head around this (while driving some 500km) and just tested an idea briefly. If we move up the Source helper function and the sourcing of the config file to before the getops (CLI options parsing), That way the sourcing the config file (or not sourcing, with Something like: ...} # end of Help() printer function
# Source helper function
source_if_exists_or_fail() {
if [[ -s "$1" ]]; then
source "$1"
# DisplaySourcedFiles used for debugging purposes only
[[ "${DisplaySourcedFiles:-false}" == true ]] && echo " * sourced config: ${1}"
return 0
else
return 1
fi
}
# Source user customizable config file prior to CLI options (if no -C option is passed)
if [[ ! ${ScriptArgs[*]} =~ "-C" ]]; then
source_if_exists_or_fail "${HOME}/.config/dockcheck.config" || source_if_exists_or_fail "${ScriptWorkDir}/dockcheck.config"
fi
while getopts ... # etc onwards |
|
I tried the branch, it does what I expect for my use case. What are you thoughts on merging this back? |
|
@403-err |
Uh oh!
There was an error while loading. Please reload this page.
Is it possible to allow command line "-d" option to override the config file? I have DaysOld="3" in the config file and could override it with -d1 on the command line, but this no longer seems to work.
It can be useful (for me) to override the waiting period if I'm doing updates manually.
All reactions