optparse
optparse copied to clipboard
ablility to rerun optparse.build more than once
on occasion i need to reparse the options so we would need to without the defaults.
command -c config_file -i override
where it would read the config file first then reparse the args to override environment variable.
calling the code would look something like
source $( optparse.build )
if [ -n "$CONFIG_FILE" ]; then
source $CONFIG_FILE_PATH
# and reparsing
source $( optparse.build "DEFAULT_OFF")
fi
and there needs to be stop gate like
# Set default variable values
if [[ "$*" == *DEFAULT_OFF* ]]; then
echo -n ""
else
$optparse_defaults
fi
# Process using getopts
OPTIND=1
while getopts "$optparse_arguments_string" option; do
case \$option in
...
(note: OPTIND=1 )
+1