-
Notifications
You must be signed in to change notification settings - Fork 370
ExpressibleByArgument, CaseIterable for array of enum not listing options during failure #401
Copy link
Copy link
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Similar to #344, when a ExpressibleByArgument & CaseIterable argument from user has incorrect value, the candidate values are shown in the error message except when said value is a member of an array.
ArgumentParser version: 1.0.3.
Swift version: swift-driver version: 1.26.21 Apple Swift version 5.5.2 (swiftlang-1300.0.47.5 clang-1300.0.29.30)
Checklist
- If possible, I've reproduced the issue using the
mainbranch of this package - I've searched for existing GitHub issues
Steps to Reproduce
With the following program:
import ArgumentParser
enum Noodle: String, CaseIterable, ExpressibleByArgument {
case ramen
case capellini
case silkworm
}
@main
struct Dinner: ParsableCommand {
@Argument
var noodle: [Noodle]
mutating func run() throws {
print("Hmm, yummy \(noodle.first!).")
}
}Build and run with a wrong value for noodle. For a SwiftPM example
swift run dinner usbcableExpected behavior
The error message should include candidate values for noodle like:
Error: The value 'hello' is invalid for '<noodle>'. Please provide one of 'ramen', 'capellini' or 'silkworm'.
Help: <noodle>
Usage: dinner <noodle>
See 'dinner --help' for more information.
Actual behavior
The output does not include candidate values for noodle
Error: The value 'hello' is invalid for '<noodle>'
Help: <noodle>
Usage: dinner [<noodle> ...]
See 'dinner --help' for more information.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request