apple / apple/swift-argument-parser
Unexpected argument when using `swift package plugin generate-manual <tool>`
- Dominant language
- Swift
- Stars
- 3.8k
- Forks
- 411
- Avg merge
- 7d 14h
- Merged PRs (30d)
- 15
Description
I'm trying to use the `generate-manual` plugin in [this repository](https://github.com/tuist/tuist) by using the following command: `swift package plugin generate-manual tuist --configuration debug`. However, the command fails with an error `Error: Unexpected argument 'tuist'`. It seems that the argument parsing logic is unable to recognize the tool argument, even though it's defined in it and shows up in the help menu.
**ArgumentParser version:** `1.4.0`
**Swift version:**
```
swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: arm64-apple-macosx14.0
```
### Checklist
- [x] If possible, I've reproduced the issue using the `main` branch of this package (commit: `bb10ca8b70fe54c67a1b3adb0f5d58341dc2ed7b`)
- [x] I've searched for [existing GitHub issues](https://github.com/apple/swift-argument-parser/issues)
### Steps to Reproduce
Clone the [this repository](https://github.com/tuist/tuist) and run the command `swift package plugin generate-manual tuist --configuration debug`.
### Expected behavior
I'd expect the command to complete successfully.
### Actual behavior
You get the following error:
```
Built package in debug mode
Generating manual for tuist...
Error: Unexpected argument 'tuist'
Usage: generate-manual [--multi-page] [--date ] [--section ] [--authors ...] --output-directory
See 'generate-manual --help' for more information.
error: 'generate-manual' invocation failed: ''generate-manual' invocation failed with a nonzero exit code: '64'.'
```
Contributor guide
Research direction
Start with the generate-manual Swift package plugin entry point and reproduce the command `swift package plugin generate-manual tuist --configuration debug` using the reported Swift and ArgumentParser versions. Compare the declared `` argument with the arguments passed to the plugin, and verify the fix by confirming the command completes without the unexpected-argument error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100