{"id":17383033,"url":"https://github.com/darrarski/swift-shell","last_synced_at":"2025-07-13T02:06:43.202Z","repository":{"id":249567945,"uuid":"831503676","full_name":"darrarski/swift-shell","owner":"darrarski","description":"Library for running shell scripts and other executables from swift code.","archived":false,"fork":false,"pushed_at":"2025-01-17T01:27:05.000Z","size":339,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-27T05:02:32.052Z","etag":null,"topics":["bash-scripting","cli","shell-scripts","swift","swift-package"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/darrarski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"darrarski","buy_me_a_coffee":"darrarski"}},"created_at":"2024-07-20T18:40:41.000Z","updated_at":"2025-01-17T01:23:58.000Z","dependencies_parsed_at":"2024-08-02T11:24:11.722Z","dependency_job_id":null,"html_url":"https://github.com/darrarski/swift-shell","commit_stats":null,"previous_names":["darrarski/swift-shell"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darrarski%2Fswift-shell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darrarski%2Fswift-shell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darrarski%2Fswift-shell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darrarski%2Fswift-shell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/darrarski","download_url":"https://codeload.github.com/darrarski/swift-shell/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":236734096,"owners_count":19196250,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash-scripting","cli","shell-scripts","swift","swift-package"],"created_at":"2024-10-16T07:40:22.443Z","updated_at":"2025-02-01T23:26:03.774Z","avatar_url":"https://github.com/darrarski.png","language":"Swift","funding_links":["https://github.com/sponsors/darrarski","https://buymeacoffee.com/darrarski","https://www.buymeacoffee.com/darrarski"],"categories":[],"sub_categories":[],"readme":"# 🐚 Swift Shell\n\n![Swift v5.10](https://img.shields.io/badge/swift-v5.10-orange.svg)\n![platform macOS](https://img.shields.io/badge/platform-macOS-blue.svg)\n\nLibrary for running shell scripts and other executables from swift code.\n\n## 📖 Documentation\n\nThe library is distributed as a swift package.\n\n```swift\n// in your Package.swift, add package dependency:\n.package(url: \"https://github.com/darrarski/swift-shell.git\", from: \"0.1.0\"),\n\n// and add the library as a dependency to your target:\n.product(name: \"SwiftShell\", package: \"swift-shell\"),\n```\n\nThe code is dressed in documentation comments that explain the purpose of each variable and function. The examples described below and the library [unit tests](Tests/SwiftShellTests) explain how to use it. You can also check out the auto-generated [documentation hosted on SwiftPackageIndex](https://swiftpackageindex.com/darrarski/swift-shell/main/documentation/swiftshell).\n\n## 📚 Examples\n\nRun bash script, send input, and retrieve the script's output:\n\n```swift\nlet process = ShellProcess(.bash(\"IFS= read -r NAME; echo Hello, $NAME!\"))\ntry await process.run()\ntry await process.send(input: \"Swift\\n\".data(using: .utf8)!)\nlet output = try await process.output()!\nprint(String(data: output, encoding: .utf8)!) // Hello, Swift!\n```\n\nCheck out the examples included in this repository:\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eSend input and stream bash script's output.\u003c/b\u003e\u003c/summary\u003e\n\n#### InputOutputExample\n\n![SwiftShell InputOutputExample](Examples/SwiftShell_InputOutputExample.gif)\n\n[Source code](Examples/Sources/InputOutputExample/InputOutputExample.swift)\n\nRun example:\n\n```sh\n$ Examples/run.sh -- InputOutputExample\n```\n\n---\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eStream and decorate bash script's output.\u003c/b\u003e\u003c/summary\u003e\n\n#### DecorateOutputExample\n\n![SwiftShell DecorateOutputExample](Examples/SwiftShell_DecorateOutputExample.gif)\n\n[Source code](Examples/Sources/DecorateOutputExample/DecorateOutputExample.swift)\n\nRun example:\n\n```sh\n$ Examples/run.sh -- DecorateOutputExample\n```\n\n---\n\n\u003c/details\u003e\n\n## 🛠 Development\n\n- Use Xcode (≥15.4).\n- Clone the repository or create a fork \u0026 clone it.\n- Open `SwiftShell.xcworkspace` in Xcode.\n- Use the `SwiftShell` scheme for building and testing the library.\n- Use other schemes to build or test examples.\n- If you want to contribute, create a pull request containing your changes or bug fixes. Make sure to include tests for new/updated code.\n\n## ☕️ Do you like the project?\n\nI would love to hear if you like my work. I can help you apply any of the solutions used in this repository in your app too! Feel free to reach out to me, or if you just want to say \"thanks\", you can buy me a coffee.\n\n\u003ca href=\"https://www.buymeacoffee.com/darrarski\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" height=\"60\" width=\"217\" style=\"height: 60px !important;width: 217px !important;\" \u003e\u003c/a\u003e\n\n## 📄 License\n\nCopyright © 2024 Dariusz Rybicki Darrarski\n\nLicense: [MIT](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarrarski%2Fswift-shell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdarrarski%2Fswift-shell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarrarski%2Fswift-shell/lists"}