-
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
feature: introduce concept of named parameters instead of optional parameters #61
Comments
Hmmm not quite sure if I'm missing something here... but I think "named parameters" is the same thing as optional flags. The idea with positional required/optional args is that they are for really simple cases. If you need more complex parameters, then optional flags might be better. Do you maybe want the ability to mark certain flags as required? |
Hmmm not quite sure if I'm missing something here... but I think
"named parameters" is the same thing as optional flags
<https://github.com/jakedeichert/mask#optional-flags>.
The idea with positional required/optional
<#5> args is that they are
for really simple cases. If you need more complex parameters, then
optional flags might be better.
It's not the same.
Do you maybe want the ability to mark certain flags as required?
Exactly, but that goes not only for "named", but also for positional
params. Ok, one can reflect that in the backend logic again of course.
|
So positional args are already always required. For optional flags, apparently clap does support making flags required. I think we can support this by adding a new field to our optional flag definition: ## cmd
**OPTIONS**
* check
* flags: -c --check
* desc: Show which files are not formatted correctly
* required If our parser finds Pretty easy to support if anyone wants to make a PR 👍 |
Find that wrong though as said.
Will implement it. |
Clap is amazing. :) |
Marking as closed due to #74 Aiming for a release this week. |
I don't like the delineation of optional/positional. Optionality should be a trait of the parameter, indifferent of how it is passed.
Hence, new delineation would be positional or named, the current "optional".
That's how argparse[1] does it essentially.
[1] https://docs.python.org/3/library/argparse.html#argparse.ArgumentParser.add_argument
The text was updated successfully, but these errors were encountered: