Skip to content
/ Shell Public
forked from BirmacherAkos/Shell

Sync & async shell API written in Swift with complete test coverage.

License

GothStar/Shell

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Shell (🥚)

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

Usage

Run (sync):

import Shell

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

Run (async):

import Shell

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

Shell (bash) with environment variables:

import Shell

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/GothStar/shell", from: "1.1.0"),

⚠️ Don't forget to add "Shell" to your target as a dependency!

License

WTFPL - Do what the fuck you want to.

About

Sync & async shell API written in Swift with complete test coverage.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 99.3%
  • Dockerfile 0.7%