Run any shell commands as if they were a prebuilt Swift function using the magic of @dynamicCallable
and @dynamicMemberLookup
.
Simply use underscores instead of dashes!
The cool names ShellSwift, Shift, Swell, Swsh, Swish, ShellKit and SwiftyShell were already taken 😭
let shell = try Shell()
try shell.git(
clone: (),
__depth: 5,
__branch: "develop",
"https://github.com/org/cool-repo.git "
)
try shell.cd("cool-repo")
let history = try shell.git(log: (), __oneline: ())
let shell = try Shell()
try shell.xcodebuild(
archive: (),
_project: "CoolApp.xcodeproj",
_scheme: "CoolApp-Prod",
_archivePath: "/tmp/output.xcarchive"
)
let shell = try Shell()
try shell.mkdir(_p: "cockle/example")
for ext in [".txt", ".swift", ".md"] {
try shell.touch("cockle/example/Hello" + ext)
}
let allFiles = try shell.ls(_l: (), _a: ())
print(allFiles.lines)