Giter Site home page Giter Site logo

processpretty's Introduction

ProcessPretty

Commandline tool that is platform endepended. Its main features are

  • captures the output for evaluation before writing to console
  • outputs in colors with optional progress bar
  • offers generic way to run asynchronous processes

This code works on windows, linux and macos.

Getting Started

You will have to install swift standard library. Follow the Swift getting started guide for the platform of your choosing.

Integrate

You will need to know about using swift package manager.

Integrate in application using SPM, in Package.swift

.package(name: "ProcessPretty", url: "https://github.com/dooZdev/ProcessPretty.gitt", <#wanted version#>)

more info on https://swift.org/package-manager/

Usage

In a main.swilf or type with @main

Add import ProcessPretty to the beginning of every file.

Synchronous

let echoSync = try ProcessPretty(executable: "echo", arguments: ["something to output in sync"])
func sync() {
    do {
        try echoSync.run(in: #function, at: #filePath)
    } catch {
        exit(EXIT_FAILURE)
    }
}

sync()

This looks up task in the PATH accessible executables. If the executable for the process to run is not found make update the PATH value.


Inspiration

Inspiration for this is taken from jakeheis/SwiftCLI. SwiftCLI does more than just run a system process. It also makes Commands, a structured way to add arguments and options to a process you run on the commandline. As for commands we use Apple's swift-argument-parser SwiftCLI was too big to use. But the way to run a task is taken from that project and used here.

processpretty's People

Contributors

doozmen avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.