-
Notifications
You must be signed in to change notification settings - Fork 353
Open
Description
Mutually exclusive EnumerableFlag & RawRepresentable flags aren't documented as such in command help.
They're just listed as independent flags.
Maybe they're also listed as independent elsewhere, e.g., generated man page, markdown, etc.
Maybe other types of mutually exclusive flags, options, arguments, whatever also suffer from this problem.
Also, the default flag is output in an overly verbose, confusing way:
--a 1 (default: --a)
Which probably should be:
--a 1 (default)
ArgumentParser version:
main
Swift version:
swift-driver version: 1.127.14.1 Apple Swift version 6.2.1 (swiftlang-6.2.1.4.8 clang-1700.4.4.1)
Target: arm64-apple-macosx26.0
Checklist
- If possible, I've reproduced the issue using the
mainbranch of this package - I've searched for existing GitHub issues
Steps to Reproduce
internal import ArgumentParser
struct C: ParsableCommand {
static let configuration = CommandConfiguration(
abstract: "C"
)
@Flag(help: "group text")
private var e = E.a
func run() {
print(e)
}
}
private enum E: String, EnumerableFlag {
case a
case b
case c
static func help(for e: Self) -> ArgumentHelp? {
switch e {
case .a:
"1"
case .b:
"2"
case .c:
"3"
}
}
}Expected behavior
$ c help
OVERVIEW: C
USAGE: cmd c [--a | --b | --c]
OPTIONS:
--a 1 (default)
--b 2
--c 3
-h, --help Show help information.Or, maybe segment the mutually exclusive options together (output could be different):
$ c help
OVERVIEW: C
USAGE: cmd c [--a | --b | --c]
OPTIONS:
group text (mutually exclusive):
--a 1 (default)
--b 2
--c 3
OTHER OPTIONS:
-h, --help Show help information.Actual behavior
$ c help
OVERVIEW: C
USAGE: cmd c [--a] [--b] [--c]
OPTIONS:
--a 1 (default: --a)
--b 2
--c 3
-h, --help Show help information.Metadata
Metadata
Assignees
Labels
No labels