I encountered some awkward ergonomics when migrating DrString to ArgumentParser.
I wish there's a way to to know whether a
Flag's value is determined by actual presence in the command line arguments, or by default.
Today, a user could supply the default value for a flag by either omitting it from command arguments, or explicitly supplying it. And as far as I know, there's no way to distinguish these two. The design space for CLI is, therefore, constrained such that we must not care about user's intention when it comes to these default values.
In my app, a user could specify an option in a config file, or they could do it as a command line argument. Crucially, when an option is present in both, the CLI value take precedence so that they can temporarily deviate from linting/formatting option of the codebase. To make this work, I have to use an
@Option() flagName Bool? as opposed to
@Flag() flagName: Bool to get the information I needed.
But that means the user must say
--flag-name true as opposed to simply
--flag-name, which is a regression in ergonomics.
I can't think of any obvious way to improve this in ArgumentParser. And, given that I've only worked with it for a few hours, it's entirely possible that I didn't think of/know of an obvious alternative. Thought I'd share here for some help/discussion :)