{"id":17688077,"url":"https://github.com/itztravelintime/command","last_synced_at":"2026-05-15T21:37:31.031Z","repository":{"id":134177734,"uuid":"380671021","full_name":"ITzTravelInTime/Command","owner":"ITzTravelInTime","description":"A Swift Library to launch, execute, and get the output of, executables and terminal commands/scripts in a simple and quick way.","archived":false,"fork":false,"pushed_at":"2022-05-31T22:21:14.000Z","size":63,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-21T15:44:41.917Z","etag":null,"topics":["library","script","swift","swiftpackage","terminal","tinu"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ITzTravelInTime.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2021-06-27T06:47:54.000Z","updated_at":"2021-11-12T17:05:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"b0fc5972-ac88-4214-b30f-a9de3b5d2a4a","html_url":"https://github.com/ITzTravelInTime/Command","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/ITzTravelInTime/Command","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ITzTravelInTime%2FCommand","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ITzTravelInTime%2FCommand/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ITzTravelInTime%2FCommand/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ITzTravelInTime%2FCommand/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ITzTravelInTime","download_url":"https://codeload.github.com/ITzTravelInTime/Command/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ITzTravelInTime%2FCommand/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33080778,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T20:25:35.270Z","status":"ssl_error","status_checked_at":"2026-05-15T20:25:34.732Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["library","script","swift","swiftpackage","terminal","tinu"],"created_at":"2024-10-24T11:43:18.846Z","updated_at":"2026-05-15T21:37:31.014Z","avatar_url":"https://github.com/ITzTravelInTime.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Command\nSwift Library to launch, run and get the output of executables and terminal commands/scripts in a simple and quick way.\n\n## Features\n- Manages the usage of Swift's `Process` Objects, and so allows the library user to: launch, run or just get the standard output/error of a `Process` execution\n- Provvides comvenint structs for abstraction and ease of usage\n- Allows for class extensions, and extension libraryes to increase the functionality offered (see the `Known extensions for this library` section for more info)\n- Provvides a protocol for extensions to conform to the basic usage of the main class\n- Debug checks to ensure the library code is used as intended\n- No particular dependecies\n\n## Usage\n\nUsage is well documented into the source code, so check that out for more info. To prevent having mirrors of this information, this file will be just limited to the following very usefoul example usage:\n\n```swift\n\nimport Foundation\nimport Command\n\n//TODO: Remove this warning when I understood what I need to do\n#warning(\"This code needs the app sandbox to be tuned off for the current project! (unless you decide to execute an embedded executable inside your app's bundle)\")\n\n//Disable debug printing for the library\nCommand.Printer.enabled = false\n\nfunc info() -\u003e String?{\n    \n    var out: String?\n        \n    //Execution of the command must be in a separated thread, not the main!\n    DispatchQueue.global(qos: .background).sync {\n        out = Command.run(cmd: \"/usr/bin/uname\", args: [\"-a\"])?.outputString() //Executes the uname -a command and returns it's ouput as a string\n    }\n    \n    return out\n}\n\nprint(info() ?? \"Error: launch of the \\\"uname -a\\\" command failed!\")\n\n```\n\n## What apps/programs is this Library intended for?\n\nThis library should be used by non-sandboxed swift apps/programs (unless only commands targeted at embedded executables inside the current bundle are run) or embedded helper tools, that needs to run terminal scripts/commands or separated executables from their own.\n\nThis code is intended for macOS only since it requires the system library `Process` type from the Swift API, that is only available on that platform.\n\n## **Warnings**\n\n - To let the code to fully work (expecially the `Command.run` and the `Command.get...` functions ) your app/program might most likely need to not be sandboxed, unless an executable located inside the current bundle is specified, see the documentation inside the source code for more details.\n - All functions from the `Command` class needs to be run from a non-main thread, except from the `Command.start` function.\n\n## Known extensions for this library\n\n - [ITzTravelInTime/CommandSudo](https://github.com/ITzTravelInTime/CommandSudo) Adds support for privileged executions using apple scripts.\n\n## About the project\n\nThis code was created as part of my [TINU project](https://github.com/ITzTravelInTime/TINU) and it has been separated and made into it's own library to make the main project's source less complex and more focused on it's aim. \n\nAlso having this as it's own library allows for code to be updated separately and so various versions of the main TINU app will be able to be compiled all with the latest version of this library.\n\n## Used libraries\n\n- [ITzTravelInTime/SwiftPackagesBase](https://github.com/ITzTravelInTime/SwiftPackagesBase)\n\n## Credits\n\n - ITzTravelInTime (Pietro Caruso) - Project creator and main developer\n\n## Contacts\n\n - ITzTravelInTime (Pietro Caruso): piecaruso97@gmail.com\n\n## Legal info\n\nSwift Library to launch, run and get the output of executables and terminal commands/scripts in a simple and quick way.\nCopyright (C) 2021-2022 Pietro Caruso\n\nThis library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.\n\nThis library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.\n\nYou should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitztravelintime%2Fcommand","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitztravelintime%2Fcommand","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitztravelintime%2Fcommand/lists"}