I'm guessing this undefined behaviour, but I'm interested to know how it should work.
Given this code:
enum AppType: String, ExpressibleByArgument, CaseIterable {
case basic
case utility
}
struct Example: ParsableCommand {
@Option()
var name: String
@Flag(default: .basic, name: .customLong("app-type"), help: "The type of app to launch")
var applicationType: AppType
}
The --help
prints this:
OPTIONS:
--application-name <application-name>
--app-type/--app-type The type of app to launch
(default: basic)
Running the command with --basic
or --utility
gives an error. Specifying --app-type
works and picks basic
(the default).
Can this be turned in to a compile time error? Not easily I suspect, there is a chance this is/can be fixed with this PR.
Also, should it even be fixed?