Skip to content
This repository has been archived by the owner on Nov 14, 2021. It is now read-only.
/ PromptLine Public archive

Run shell scripts out of Swift with ease

License

Notifications You must be signed in to change notification settings

vknabel/PromptLine

Repository files navigation

PromptLine

Run shell scripts out of Swift with ease.

Usage

With PromptLine you may combine multiple runner into one. Later you may run them against a specific Prompt.

import PromptLine

let main = >-"git clone https://github.com/krzysztofzablocki/Sourcery.git"
    %& Prompt.cd("Sourcery")
    %& >-"swift build"
    %& >-["./.debug/sourcery", sourcePath, templatesPath, outputPath]

Prompt.current >- main

Operators

PromptLine uses these operators:

Operator Function Usage
>- prompt.run("string") Creates a runner out of Strings or String arrays.
>- runner(prompt) Executes a runner against a prompt.
%& flatMap(_:_:) Chains two runners. The right one will only be executed if the first succeeds.
`% ` flatMapError(_:_:)
%> second(_:_:) Chains two runners. Both will always be executed.
%? mapError(_:_:) Maps an error.

Installation

You may install PromptLine using the Swift Package Manager, by adding it to your dependencies.

import PackageDescription

let package = Package(
    name: "YourPackage",
    dependencies: [
        .Package(url: "https://github.com/vknabel/PromptLine.git", majorVersion: 0, minor: 5),
    ]
)

Author

Valentin Knabel, @vknabel, dev@vknabel.com

License

PromptLine is available under the MIT license.

About

Run shell scripts out of Swift with ease

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages