swift-argument-parser
swift-argument-parser copied to clipboard
AsyncParsableCommand documentation
Right now, if you supply an async rendition of run() in conjunction with ParsableCommand, it produces no warning or error, but whenever you run the app, you simply see the “USAGE” text. It took a surprising/unnecessary amount of time pouring through the class library and looking at a particular code sample, before I stumbled across AsyncParsableCommand.
-
Ideally, it would be great to produce a meaningful warning/error when a valid
run()is not found. It obviously fell through to a point where “USAGE” text was displayed. Is it possible to give us some warning why we got the “USAGE” text? -
I would suggest that the
README.mdand the documentation introduction make some reference toAsyncParsableCommandforasyncrenditions ofrun(). This should be more easily discovered.
If you would like me to take a pass at a PR to that end, please let me know.
Ideally, it would be great to produce a meaningful warning/error when a valid run() is not found. It obviously fell through to a point where “USAGE” text was displayed. Is it possible to give us some warning why we got the “USAGE” text?
I don't think we can detect that this is happening. Ideally Swift would warn for this near-miss implementation, but since the ParsableCommand protocol provides the default implementation for run(), there isn't an unsatisfied requirement to complain about.
I would suggest that the README.md and the documentation introduction make some reference to AsyncParsableCommand for async renditions of run(). This should be more easily discovered.
A PR for this would be great, thank you!
@natecook1000 - I have submitted PR https://github.com/apple/swift-argument-parser/pull/565 with an attempt to make AsyncParsableCommand more easily discovered. If you have suggestions you would like me to incorporate, please let me know.
Needless to say, feel free to make whatever changes you want. My intent was simply to move the ball forward.