Skip to content

Latest commit

 

History

History
52 lines (38 loc) · 1.56 KB

ReadMe.md

File metadata and controls

52 lines (38 loc) · 1.56 KB

Cockle

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 😭

Examples

Cloning a Git repo

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: ())

Archiving using Xcodebuild

let shell = try Shell()

try shell.xcodebuild(
    archive: (),
    _project: "CoolApp.xcodeproj",
    _scheme: "CoolApp-Prod",
    _archivePath: "/tmp/output.xcarchive"
)

Creating some files

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)