Built for any swift project
.package(url: "https://github.com/MihaelIsaev/SwiftBash.git", from:"1.0.0")
In your target's dependencies add "Bash"
e.g. like this:
.target(name: "App", dependencies: [
.product(name: "Bash", package: "SwiftBash")
]),
import Bash
try {
let pathToProgram = try bash.which("systemd")
} catch {
if let error = error as? WhichError {
switch error {
case .notFound(let program):
print("Program not found")
}
} else {
print("Bash error: \(error)")
}
}
Foundation
only
Please feel free to contribute!