https://github.com/dfed/swift-shell
A simple wrapper for executing shell commands from Swift
https://github.com/dfed/swift-shell
Last synced: about 1 year ago
JSON representation
A simple wrapper for executing shell commands from Swift
- Host: GitHub
- URL: https://github.com/dfed/swift-shell
- Owner: dfed
- License: mit
- Created: 2022-04-22T02:42:15.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2025-03-18T15:28:06.000Z (about 1 year ago)
- Last Synced: 2025-04-06T04:48:48.974Z (about 1 year ago)
- Language: Swift
- Size: 37.1 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: Contributing.md
- License: LICENSE
Awesome Lists containing this project
README
# swift-shell
[](https://github.com/dfed/swift-shell/actions?query=workflow%3ACI+branch%3Amain)
[](https://spdx.org/licenses/MIT.html)
A simple wrapper for executing shell commands from Swift
## Usage
```
import SwiftShell
// Getting output from a shell command:
let output = try Process.execute(#"echo "Hello, world!""#)
// Getting output from a shell command within a specific directory:
let output = try Process.execute("ls", within: .path("~/"))
// Getting output from a shell command within a specific directory:
let output = try Process.execute("ls", within: .url(.init(filePath: "/tmp/")))
```
## Requirements
- Swift 6
- Xcode 16.0