Swiftpack.co - christopherweems/_AsyncParsableCommand as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
christopherweems/_AsyncParsableCommand
Drop-in replacement for ParsableCommand to use async/await in swift-argument-parser commands
.package(url: "https://github.com/christopherweems/_AsyncParsableCommand.git", from: "0.0.3")

_AsyncParsableCommand

A drop-in replacement for ParsableCommand allowing you to use async/await in ParsableCommand.run() without managing tasks.

Hopefully just here to hold you over until async/await support lands in swift-argument-parser.

Usage

import ArgumentParser
import AsyncParsableCommand

struct Countdown: _AsyncParsableCommand {
    @Argument var count: Int
    
    func run() async throws {
        var remaining = count
        
        while 0 < remaining {
            print("\(remaining)!")
            await Task.sleep(1_000_000_000)
            remaining -= 1
        }
        
        print("Countdown complete!")
        
    }
    
}

GitHub

link
Stars: 0
Last commit: 1 week ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Release Notes

_AsyncParsableCommand 0.0.3
1 week ago

Conditionally skip async test on non-macOS targets (async tests fail on Linux)

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics