You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Replace broken open-coding of FromStr with derive(clap::ValueEnum)
We've seen that `impl FromStr for Format` missed the `"exe"` match arm
in parsing (#194) despite being listed in the allowed values in our
top-level documentation and help text.
Instead of fixing this mistake, remove open-coded `FromStr` entirely and
rely on `clap`'s excellent `ValueEnum` derive. This not only generates
a **complete** parser (with the option for attributes to change variant
names) but also automates generation of a list of possible values,
getting rid of any ambiguity/duplication/copy-paste errors we might have
or create in the future:
❯ cargo r -- build -h
...
Usage: x build [OPTIONS]
Options:
...
--platform <PLATFORM>
Build artifacts for target platform [possible values: android, ios, linux, macos, windows]
--arch <ARCH>
Build artifacts for target arch [possible values: arm64, x64]
...
--format <FORMAT>
Build artifacts with format [possible values: aab, apk, appbundle, appdir, appimage, dmg, exe, ipa, msix]
--store <STORE>
Build artifacts for target app store [possible values: apple, microsoft, play, sideload]
Finally, we also utilize its generated `PossibleValue::get_name()` to
implement our open-coded `Display` implementations, ensuring any renames
via clap attributes trickle through into how we print them.
0 commit comments