Script.swift is a small library that lets you write a Swift script with ease by using method chaining, inspired by bitfield/script.
Via Swift Package Manager
Add this line in
dependencies of your
.package(url: "https://github.com/KS1019/Script.swift", from: "0.0.1")
Add this line at the top of your Swift script. Refer to swift-sh documentation for more details.
import ScriptSwift // KS1019/Script.swift ~> 0.0.1
||Continues only if a file exists|
||Writes data to a file|
||Reads data from a file|
||Returns the number of lines|
||Returns an array of string representation of files|
||Returns lines of a string as an array|
See documentation for more details.
When you want a script, you typically want it in a single file. With usual setup using Swift Package Manager to interact with external libraries, you would end up a directory with
Package.swift, which is bit much as a script.
swift-sh, you only have to take care of a single Swift file for your script, which makes your Swift script as portable as possible.
|Last commit: Yesterday|
Full Changelog: https://github.com/KS1019/Script.swift/commits/0.0.1