Open numist opened 5 months ago
I'm not fully convinced this is a readability improvement over the valid options appearing below.
IMO the synopsis should be succinct and the options below should contain the details.
Reasonable! What got me started down this path was the idea that it should be possible to write a correct invocation of a command after the briefest possible glance at its usage, which is necessarily at odds with brevity (and introduces repetition).
Another possibility is that ArgumentParser could expand values only when the options are not explained ("short help", in this reply to Nate)
Coming back to this – what would you think about reducing the scope, so that this adds the supported values for options (e.g. [--ripeness <under|perfect|over>]
) but doesn't replace the placeholder name for arguments or subcommands? The option value change seems purely additive, but we'll need to discuss the other two a bit more. Thanks!
Done!
This PR adds support for conditionally expanding argument and subcommand synopses to reflect supported values when there are multiple values and their combined length is not overly onerous.
To use an example from
math
, this PR changes the current:to
But does not change the output for commands with a single subcommand or commands with very long subcommands.
Checklist