-
Notifications
You must be signed in to change notification settings - Fork 350
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
--help flag of a subcommand or also help <subcommand> does also print options from the main command
ArgumentParser version: main
Swift version: 5.3.2
Checklist
- If possible, I've reproduced the issue using the
mainbranch of this package - I've searched for existing GitHub issues
Steps to Reproduce
- Checkout main branch
- Add any
@Optionor@Flagto theMathstruct - Build the project with
swift build - Run
math add --help
Sample:
struct Math: ParsableCommand {
static var configuration = CommandConfiguration(
...
)
@Option(help: "Test option.")
var test: String?
}
Expected behavior
Help of the subcommand only should be printed, options of the main command should not be printed
Sample:
OVERVIEW: Print the sum of the values.
USAGE: math add [--hex-output] [<values> ...]
ARGUMENTS:
<values> A group of integers to operate on.
OPTIONS:
-x, --hex-output Use hexadecimal notation for the result.
--version Show the version.
-h, --help Show help information.
Actual behavior
- Overview, usage, arguments of the subcommand are being printed ✅
- Options of the subcommand are being printed ✅
- Options of the main command are being printed ❌
Sample:
OVERVIEW: Print the sum of the values.
USAGE: math add [--hex-output] [<values> ...]
ARGUMENTS:
<values> A group of integers to operate on.
OPTIONS:
--test <test> Test option.
-x, --hex-output Use hexadecimal notation for the result.
--version Show the version.
-h, --help Show help information.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working