Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Script
Source
.gitignore
LICENSE
Package.swift
README.md

README.md

SwiftyScript

Talk to terminal.

Usage

0x01

// Use String
"echo Hello World".runAsBash()

0x02

// Run Other Progress
"""
echo 'import Foundation\nprint("Hello World From Swift")' > main.swift
swiftc main.swift
./main
""".runAsBash()

0x03

// Get Infomation From Command
let swiftTarget = "swift --version".runAsBash(output: .log).log.components(separatedBy: "\n")[1]
print("\(swiftTarget)")

0x04

// Build Project
let projects: [(name: String, buildTime: TimeInterval)] = [
    ("Project A", 2.0),
    ("Project B", 0.5),
    ("Project C", 0.1),
    ("Project D", 0.2),
    ("Project E", 2.5),
]

[
    "echo 'Building...'",
    projects.map { (name, time) in
    """
    echo '> Building \(name)...'
    echo 'runing xcbuild...'
    # do some job here
    sleep \(time)
    """
    }.joinedScript(),
    "echo 'Done.'",
]
.joinedScript()
.runAsBash(name: "Build Project", printTaskInfo: true)

0x05

// Use Task
Task.init(language: .Bash, content: "echo Bye").run()
You can’t perform that action at this time.