Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mihaelisaev/swiftbash

Tiny little library which gives simple access to several bash commands
https://github.com/mihaelisaev/swiftbash

Last synced: 6 days ago
JSON representation

Tiny little library which gives simple access to several bash commands

Awesome Lists containing this project

README

        



MIT License


Swift 5.1


Swift.Stream


#### Support this lib by giving a ⭐️

Built for any swift project

## How to install

### Swift Package Manager

```swift
.package(url: "https://github.com/MihaelIsaev/SwiftBash.git", from:"1.0.0")
```
In your target's dependencies add `"Bash"` e.g. like this:
```swift
.target(name: "App", dependencies: [
.product(name: "Bash", package: "SwiftBash")
]),
```

## Usage

### Which
```swift
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)")
}
}
```

## Dependencies

`Foundation` only

## Contributing

Please feel free to contribute!