apple / apple/swift-argument-parser
AsyncParsableCommand exits before running `run() async`
- Dominant language
- Swift
- Stars
- 3.8k
- Forks
- 411
- Avg merge
- 7d 13h
- Merged PRs (30d)
- 17
Description
When using an AsyncParsableCommand with @main, the command-line-tool exits without running the `run() async` function and prints the help log.
Note: `run()` without `async` runs the function.
**ArgumentParser version:** `1.2.0`
**Swift version:** swift-driver version: 1.45.2 Apple Swift version 5.6 (swiftlang-5.6.0.323.62 clang-1316.0.20.8)
**MacOS** 12.6
### Checklist
- [x] If possible, I've reproduced the issue using the `main` branch of this package
- [x] I've searched for [existing GitHub issues](https://github.com/apple/swift-argument-parser/issues)
### Steps to Reproduce
Option A: Reproduce by running the [Example in this repository](https://github.com/apple/swift-argument-parser/blob/main/Examples/count-lines/CountLines.swift)
Option B:

### Expected behavior
The `run() async` function should run
### Actual behavior
The `run() async` function isn't run and the program exits with the help log.
Contributor guide
Research direction
Start by reproducing the issue with Examples/count-lines/CountLines.swift, focusing on its AsyncParsableCommand entry point and the difference between run() and run() async. Confirm that the async function is skipped and help is printed; done means the async run() executes for the documented example instead of exiting with the help log.
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
- Clearly specified
- Newbie friendliness
- 35/100