Commit Graph

2 Commits

Author SHA1 Message Date
Nate Cook 055e0eaf8c Fix broken links/incorrect variance calculation (#422) 2022-03-15 12:05:09 -05:00
Nate Cook 1141ed1e1b Support an async entry point for commands (#404)
Adds a new `AsyncParsableCommand` protocol, which provides a
`static func main() async` entry point and can call through to the root
command's or a subcommand's asynchronous `run()` method. For this
asynchronous execution, the root command must conform to `AsyncParsableCommand`,
but its subcommands can be a mix of asynchronous and synchronous commands.

Due to an issue in Swift 5.5, you can only use `@main` on an
`AsyncParsableCommand` root command starting in Swift 5.6.
This change also includes a workaround for clients that are using Swift 5.5.
Declare a separate type that conforms to `AsyncMainProtocol` and add the `@main`
attribute to that type.

```
@main enum Main: AsyncMain {
    typealias Command = <#command#>
}
```
2022-03-14 18:14:09 -05:00