Commandline tool that is platform endepended. Its main features are
This code works on windows, linux and macos.
You will have to install swift standard library. Follow the Swift getting started guide for the platform of your choosing.
You will need to know about using swift package manager.
Integrate in application using SPM, in Package.swift
.package(name: "ProcessPretty", url: "https://github.com/dooZdev/ProcessPretty.gitt", <#wanted version#>)
more info on https://swift.org/package-manager/
In a main.swilf or type with @main
Add import ProcessPretty
to the beginning of every file.
let echoSync = try ProcessPretty(executable: "echo", arguments: ["something to output in sync"])
func sync() {
do {
try echoSync.run(in: #function, at: #filePath)
} catch {
exit(EXIT_FAILURE)
}
}
sync()
This looks up task in the PATH
accessible executables. If the executable for the process to run is not found make update the PATH
value.
Inspiration for this is taken from jakeheis/SwiftCLI. SwiftCLI does more than just run a system process. It also makes Commands, a structured way to add arguments and options to a process you run on the commandline. As for commands we use Apple's swift-argument-parser SwiftCLI was too big to use. But the way to run a task is taken from that project and used here.
link |
Stars: 0 |
Last commit: 2 years ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics