CaseIterable @Flag()'s and customs names

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?

This is solved in Unique argument names validator by toddthomas · Pull Request #118 · apple/swift-argument-parser · GitHub

My @Flag example did not have explicit tests but I have left the author a comment.

I'm working on a change to address the larger issue in this PR, which introduces an EnumerableFlag protocol with a customization hook for providing individual names for each case: Add an EnumerableFlag protocol by natecook1000 · Pull Request #65 · apple/swift-argument-parser · GitHub