Swiftpack.co - BinaryBirds/shell-kit as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by BinaryBirds.
BinaryBirds/shell-kit 1.0.1
Shell is a simple package that gives you the ability to call shell commands through Swift.
⭐️ 13
🕓 2 years ago
.package(url: "https://github.com/BinaryBirds/shell-kit.git", from: "1.0.1")

ShellKit (🥚)

Shell is a simple package that gives you the ability to call shell commands through Swift.

Usage

Run (sync):

import ShellKit

let output = try Shell().run("ls ~")

Run (async):

import ShellKit

Shell().run("sleep 2 && ls ~") { result, error in
    //...
}

Shell (bash) with environment variables:

import ShellKit

let shell = Shell("/bin/bash", env: ["ENV_SAMPLE_KEY": "Hello world!"])
let out = try shell.run("echo $ENV_SAMPLE_KEY")

You can even set custom ouptut & error handlers.

Install

Just use the Swift Package Manager as usual:

.package(url: "https://github.com/binarybirds/shell-kit", from: "1.0.0"),

Don't forget to add "ShellKit" to your target as a dependency:

.product(name: "ShellKit", package: "shell-kit"),

That's it.

License

WTFPL - Do what the fuck you want to.

GitHub

link
Stars: 13
Last commit: 2 years ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

3 years ago
  • removed dynamic library

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