-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Let user specify default/fallback value for named flags #59
Comments
A flag doesn't make sense with a default. |
I agree with @ogata-k . I'd even extend this to more complex types (e.g. dicts) and phasing in defaulting for both categories, optional/positional parameters. In line with what py argparse [1] does. argparse could be inspiration for more features I sense. [1] https://docs.python.org/3/library/argparse.html#argparse.ArgumentParser.add_argument |
A As a workaround for now, in my readme example I used a bash fallback value like this: PORT=${port:-8080} # Set a fallback port if flag is not supplied So whatever scripting language you're using, you can easily check if the flag is unset and use your fallback for now. |
I think so too in now for default flag. |
A |default: something| flag value is easy to support.
As a workaround for now, in my readme example I used a bash fallback
value like this:
PORT=${port:-8080} # Set a fallback port if flag is not supplied
So whatever scripting language you're using, you can easily check if
the flag is unset and use your fallback for now.
Yes sure, for bash moreover, one can:
~~~bash
set -eEu
[...]
~~~
To prevent unset params.
Still native mask feature wouldn't harm I sense.
|
A default value is convenient when you don't remember how to manipular environment variable with other languages, and some language like Java is hard to export environment. |
Definitely +1 on this It's a three line change, why even discuss this? |
I'll reopen this since it does seem useful as a feature. Specifying a default value for a flag lets the user easily see what the fallback value is if they don't supply one.
Just because it's a quick change (plus writing tests, documentation) doesn't automatically mean that it should be something we add. Opening an issue for proposing & discussing new features is preferred and it lets me gauge how much interest there is. In this case, there's definitely interest. |
I want to specify parameters list and default for option.
For instance.
When make command "formatter" from csv to json or tsv, with default no-convert,I want to specify following:
The text was updated successfully, but these errors were encountered: