Closed gdevenyi closed 7 years ago
If you pass it, it's on, if you don't it's off.... I don't get what you're asking
I can define a argument like this:
-t --temp [arg] Location of tempfile. Default="/tmp/bar"
In which case it takes a default value.
Is it possible to default "enable" a flag and perhaps offer a "no" option to turn it off?
what stops you from assuming yes/on in your code and having a flag like this
-r --remove Remove file after processing. This is the default.
-R --no-remove Do not remove file after processing.
your code would then do something like
if [[ "${arg_R}" != "1" ]]
I still don't get it... Instead of --my-flag # off by default
you can just negate it --not-my-flag # feature on by default
How do you propose the parsing block would look, and what advantage use-case would there be over just creating a negated flag to be on by default?
I'm dumb @mstreuhofer's solution is exactly what I should be doing.
Sorry.
no worries, I either already opened this request, or very nearly opened it before realizing that it's more or less a noop
Perhaps we can add this usecase to the FAQ or even right in main.sh, so that it's more apparent - what you do you all think?
I see examples for setting defaults for arguments with options, what about arguments without options?