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 await shell.git(
clone: (),
__depth: 5,
__branch: "develop",
"https://github.com/org/cool-repo.git "
)
try await shell.cd("cool-repo")
let history = try await shell.git(log: (), __oneline: ())let shell = try Shell()
try await shell.xcodebuild(
archive: (),
_project: "CoolApp.xcodeproj",
_scheme: "CoolApp-Prod",
_archivePath: "/tmp/output.xcarchive"
)let shell = try Shell()
try await shell.mkdir(_p: "cockle/example")
for ext in [".txt", ".swift", ".md"] {
try await shell.touch("cockle/example/Hello" + ext)
}
let allFiles = try await shell.ls(_l: (), _a: ())
print(allFiles.lines)