-
-
Notifications
You must be signed in to change notification settings - Fork 8
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: default_format
parameter on Arg
#184
Comments
I expected to not want to get into this, reading the title. mostly because could always just supply it as part of the help text itself. But then problem becomes, you need a per-arg way to turn that behavior off anyways, so it might as well just flexibly allow formatting, and So i think i'm down for this |
Honestly I'd be fine writing the default text in each argument's help text, if the help text has all the necessary placeholders that get formatted with |
I mean it doesnt currently. the You could globally disable the What's nice about |
I would likely expect a
So, in this case, I would actually avoid writing the default in
Yes!
True. That works when the CLI default value is assigned to a name in the current scope ( |
I suddenly realized I had already implemented It occurred to me that, similar to This was added recently enough (0.24.0) for an internal-facing feature that I'd probably be willing to rename this to But as I was implementing it "show_default" imo does linguistically cover both whether to show and/or how to show. and the dual (Whereas default_format=False doesn't as well). |
Yeah reusing |
I find myself wanting to customize how each default value is displayed in the CLI.
Examples
The following option should display the path to the default config file as default value, not the config object representation:
The following option should display "standard error" (without the quotes) as default value:
The following option should display
`INFO`
as default value (with the backticks), not justINFO
(without backticks):It's not possible to configure all these at once with for example:
...since as we saw some defaults should be wrapped in backticks, and other shouldn't. Other default values might provide their own
__str__
method, which again outputs backticks or not (see #180 (comment)).Suggestion
Accept a
default_format
parameter onArg
? This way we could do this:Ideally the
Arg
class would provide a method to render the default value according todefault_format
, to be used in scripts, for example when rendering Markdown/HTML docs for the CLI. This way we could do this:...instead of reimplementing the logic ourselves.
WDYT☺️ ?
The text was updated successfully, but these errors were encountered: