{"id":22763289,"url":"https://github.com/nikstar/proc","last_synced_at":"2025-03-30T09:41:38.543Z","repository":{"id":168257808,"uuid":"194939696","full_name":"nikstar/Proc","owner":"nikstar","description":"Convinient process API for Swift","archived":false,"fork":false,"pushed_at":"2019-08-21T22:36:25.000Z","size":18,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-05T11:44:48.869Z","etag":null,"topics":["cli","process","swift","swift-script"],"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/nikstar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2019-07-02T21:52:00.000Z","updated_at":"2019-08-21T22:35:44.000Z","dependencies_parsed_at":null,"dependency_job_id":"f7b16691-1291-47e7-9522-0b7c4156f500","html_url":"https://github.com/nikstar/Proc","commit_stats":null,"previous_names":["nikstar/proc"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikstar%2FProc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikstar%2FProc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikstar%2FProc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nikstar%2FProc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nikstar","download_url":"https://codeload.github.com/nikstar/Proc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246301961,"owners_count":20755512,"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":["cli","process","swift","swift-script"],"created_at":"2024-12-11T11:07:56.916Z","updated_at":"2025-03-30T09:41:38.533Z","avatar_url":"https://github.com/nikstar.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Proc\n\nConvenient process API for Swift.\n\n![Swift 5](https://img.shields.io/badge/swift-5-important)\n![Platforms](https://img.shields.io/badge/platforms-macOS%20%7C%20Linux-lightgrey)\n![Swift Package Manager](https://img.shields.io/badge/spm-compatible-brightgreen)\n![release](https://img.shields.io/github/release/nikstar/Proc)\n![GitHub](https://img.shields.io/github/license/nikstar/Proc)\n\n- [x] Read standard output into a string\n- [x] Pipe several commands together\n- [x] Change environment\n\nSee `ProcExample` for working example.\n\n**This is work in progress. PRs and suggestions are welcome!**\n\nAdd to your project via Swift package manager:\n\n```\n        .package(\"https://github.com/nikstar/Proc.git\", from: \"1.0.0\")\n```\n\n## Examples\n\n```swift\nlet ls = Proc(\"/bin/ls\")\nlet sort = Proc(\"/usr/bin/sort\", \"-r\")\nlet wc = Proc(\"/usr/bin/xargs\", \"wc\", \"-c\")\n\nlet output = try ls\n    .pipe(to: sort)\n    .pipe(to: wc)\n    .runForStdout()\n```\n\nDefault initializer takes absolute or relative path as first argument. Convenience initializer `init(name:)` takes the name of the tool and uses `env` behind the scenes. `/usr/local/bin` is added to `$PATH` enviroment variable.\n\n```swift\nlet ffmpeg = Proc(name: \"ffmpeg\", \"-version\") \n// same as Proc(\"/usr/bin/env\", \"ffmpeg\", \"-version\") + modified $PATH\n\ntry ffmpeg.run()\nffmpeg.waitUntilExit()\n```\n\nEnvironment is inhereted from current process and can be modified using `environment`:\n\n```swift\nlet srv = Proc(name: \"myserver\")\n    .environment { env in \n        env[\"ACCESS_TOKEN\"] = token\n    }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikstar%2Fproc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnikstar%2Fproc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnikstar%2Fproc/lists"}