When building CLIs with Swift Argument Parser, and a value needs to be a choice among a set of string-backed enumerations, there seems to two valid styles: a @Flag enum that conforms to EnumerableFlag, or an @Option enum that conforms to ExpressibleByArgument.
I've been thinking a lot about the UX ramifications of each, and I'd be curious to hear what everyone else's thoughts, insights, and opinions are.
In some cases, I find explicit
@Option names to be more clear. For example:
combine-words foo bar --output-color=red
... is much more clear than:
combine-words foo bar --red
In other cases, though, I find flags to be equally clear in their meaning, thus making the named option redundant. For example:
say foo bar --excited
... seems just as clear and intuitive as:
say foo bar --tone=excited
So maybe that's when flags are a better choice -- when an option wouldn't really add more clarity or descriptiveness? Beyond that point, the decision between flag or option seems to come down to what's more optimal: brevity or expressivity. Which, again, can always depend .
Anyways... I just wanted to get the current state of my thinking out of my head and see if the discussion helps anyone else .