-
Notifications
You must be signed in to change notification settings - Fork 349
Description
If I have
enum CoverageFormat: String, ExpressibleByArgument, CaseIterable {
case json
case html
var defaultValueDescription: String {
switch self {
case .json: "Produces a JSON coverage report."
case .html: "Produces an HTML report producd by llvm-cov. The HTML report can be configured using a reponse file stored in the project repository. See 'TODO' for more."
}
}
}
And in my AsyncParseableCommand
, I have
@Option(
help: "Format of the code coverage output. One of 'json' or 'html'.",
)
var format: [CoverageFormat] = [.json]
running the --help
option produces the following
--codecov-format, --code-coverage-format, --coverage-format <format>
(values: json, html; default: Produces a JSON coverage report.)
Replace this paragraph with a short description of the incorrect incorrect behavior. If this is a regression, please note the last version that the behavior was correct in addition to your current version.
ArgumentParser version: main
branch at commit ID 04695ec5448962bcd5e4616ed184b8a2168751e7
Swift version:
❯ swift --version
Apple Swift version 6.2 (swift-6.2-RELEASE)
Target: arm64-apple-macosx26.0
Build config: +assertions
Checklist
- If possible, I've reproduced the issue using the
main
branch of this package - I've searched for existing GitHub issues
Steps to Reproduce
A minimal reproducible case has been added here: https://github.com/bkhouri/sap-reproducible-example.git
- clone https://github.com/bkhouri/sap-reproducible-example.git
- run
swift run sap-reproducible-example --help
or follow the instructions in the README.md
Expected behavior
The --help
output for the options that is an array of enum display the proper default:
value, and also lists the description of each enum item. it addition, which may be outside the scope of this issue, would be a help string that automatically indicate the --format-as-array
can be specified multiple times.
That is, the output looks something like
--format-as-array <format>
Specify the output format. Available options: json, xml, yaml, plain (default: [plain])
json - Output in JSON format
xml - Output in XML format
yaml - Output in YAML format
plain - Output in plain text format
Actual behavior
--format-as-array <format-as-array>
Specify the output format. Available options: json, xml, yaml, plain (values: json, xml, yaml, plain; default: Output in plain text
format)