Swiftpack.co - Kitura/SwiftShellUtilities as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Utility classes to help with common system/shell actions in Swift
.package(url: "https://github.com/Kitura/SwiftShellUtilities.git", from: "0.1.1")


build status macOS Linux Apache 2

`SwiftShellUtilities` is a set of classes that are typically useful when using Swift as a command-line tool.


Swift Package Manager

import PackageDescription

let package = Package(
    name: "YourAwesomeSoftware",
    dependencies: [
        .package(url: "https://github.com/Kitura/SwiftShellUtilities.git", from: "0.1.0")
    targets: [
            name: "MyApp",
            dependencies: ["SwiftShellUtilities"]


#!/usr/bin/swift sh

import SwiftShellUtilities          // @Kitura

System Action

Currently the only class supported is SystemAction which allows command-line tools to more easily support variations of verbose/dry-run. It uses the Rainbow library for colorized output and SwiftShell for executing commands.

A typical swift-argument-parser based program may look something like this:

import ArgumentParser   // https://github.com/apple/swift-argument-parser.git

struct BuildCommand: ParsableCommand {
   @Flag(name: .shortAndLong, help: "Enable verbose mode")
   var verbose: Bool = false

   @Flag(name: [.customLong("dry-run"), .customShort("n")], help: "Dry-run (print but do not execute commands)")
   var enableDryRun: Bool = false

   mutating func run() throws {
       let actions: SystemAction
       if enableDryRun {
           actions = CompositeAction([SystemActionPrint()])
       } else if verbose {
           actions = CompositeAction([SystemActionPrint(), SystemActionReal()])
       } else {
           actions = CompositeAction([SystemActionReal()])
       try actions.runAndPrint(command: "echo", "Hello", "World!")



Stars: 0
Last commit: 2 weeks 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

Initial release
2 weeks ago

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