Commit Graph
9 Commits
Author SHA1 Message Date
Nate Cook 134451f572 Fix up license headers and enable check (#746) 2025-02-24 06:53:19 -08:00
Nate Cook 5bb54b937c Specify availability for remainder of platforms (#741) 2025-02-16 21:08:42 -06:00
Rauhul Varma 10d80282e5 Enable swift-format checking (#711)
Adopts the common swift-mmio and swift-argument-parser format and enables CI checking.

Fixes: #702
2025-02-10 14:58:19 -08:00
Kotaro Suto 1d191b00ea Prefer if-let shorthand in CountLines.swift (#638) 2024-05-09 10:33:30 -07:00
Nate Cook 1ed0ac0925 Switch count-lines to macOS 12 only (#576)
CI is allowing a `guard #available(macOS 12)` in the tests to pass,
but then reporting macOS version 10.16 both in ProcessInfo and in
the guard in the actual `CountLines.run()` method, which results
in an inconsistency. Switching the minimum platform for 
`count-lines` until we can sort out the configuration issue.
2023-06-28 12:28:39 -05:00
Nate Cook 9f103e4e68 Include more platforms in availability (#539) 2023-01-09 11:11:22 -06:00
Nate Cook 0bac2cc0f1 Allow default nil values for optional properties (#480)
This adds underscored initializers that let library users add `= nil` to
declarations of optional `@Option` and `@Argument` properties. Previously,
default values have been available for properties of non-optional types
only.

These new initializers use `_OptionalNilComparisonType` as the wrapped
value parameter, so only a `nil` literal is acceptable in the default
value position. This avoids the problem of declaring an optional property
with a non-`nil` default, which ends up negating the purpose of an optional.
2022-08-30 22:23:15 -05:00
Nate Cook 777930b99d Remove platform requirement from Package.swift (#427)
Adding the platform requirement is a source breaking change; this moves
the requirement down to the `async` symbols instead.
2022-03-16 07:30:46 -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