I'm using Swift 6.0, and Im trying to use adhere to to the AsyncParsableCommand protocol. However I'm noticing that no matter what, my program always returns the help text instead of actually running.
There's post here describing this issue as well. Seems like the compiler favors the sync run command over the async run command.
Here's my main file. Just trying to print a string right now.
import ArgumentParser
@main
struct PhpFlayer: AsyncParsableCommand {
mutating func run() async throws {
print("I'm working!")
}
}
ArgumentParser version: main branch
Swift version: swift-driver version: 1.113 Apple Swift version 6.0 (swiftlang-6.0.0.7.6 clang-1600.0.24.1) Target: arm64-apple-macosx14.0.
Checklist
- [x ] If possible, I've reproduced the issue using the
main branch of this package
- [x ] I've searched for existing GitHub issues
Steps to Reproduce
- Create an empty project
mkdir MyCLI && cd MyCLI
swift package init --name MyCLI --type executable
- Setup the entry file and add the argument parser package
- Add the argument parser package to
Package.swift
- rename
Sources/main.swift to Sources/MyCLI.swift
- setup the following main struct
import ArgumentParser
@main
struct MyCLI: AsyncParsableCommand {
mutating func run() async throws {
print("I'm working!")
}
}
- Run the program and see only help text show up instead of "I'm Working!"
Expected behavior
I'd expect when running swift run MyCLI that i would see "I'm working!" in the terminal.
Actual behavior
Right now this always displays the help text.
I'm using Swift 6.0, and Im trying to use adhere to to the AsyncParsableCommand protocol. However I'm noticing that no matter what, my program always returns the help text instead of actually running.
There's post here describing this issue as well. Seems like the compiler favors the sync run command over the async run command.
Here's my main file. Just trying to print a string right now.
ArgumentParser version:
mainbranchSwift version:
swift-driver version: 1.113 Apple Swift version 6.0 (swiftlang-6.0.0.7.6 clang-1600.0.24.1) Target: arm64-apple-macosx14.0.Checklist
mainbranch of this packageSteps to Reproduce
mkdir MyCLI && cd MyCLIswift package init --name MyCLI --type executablePackage.swiftSources/main.swifttoSources/MyCLI.swiftExpected behavior
I'd expect when running
swift run MyCLIthat i would see "I'm working!" in the terminal.Actual behavior
Right now this always displays the help text.