All Projects β†’ jojomi β†’ go-script

jojomi / go-script

Licence: MIT license
Go library facilitating the creation of programs that resemble bash scripts.

Programming Languages

go
31211 projects - #10 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to go-script

Jscost.org
JSCost.org - a JavaScript cost visualizer πŸ’Έ
Stars: ✭ 101 (+676.92%)
Mutual labels:  compile
Discovery
Discoveries on Sustainable Loading research
Stars: ✭ 174 (+1238.46%)
Mutual labels:  compile
documentify
Modular HTML bundler
Stars: ✭ 47 (+261.54%)
Mutual labels:  compile
Shadow Rs
A build-time information stored in your rust project.(binary,lib,cdylib,dylib)
Stars: ✭ 117 (+800%)
Mutual labels:  compile
Handlebars Helpers
Related projects
Stars: ✭ 2,024 (+15469.23%)
Mutual labels:  compile
Improvexamarinbuildtimes
Tips and tricks on how to speed up the time it takes to compile a Xamarin app
Stars: ✭ 180 (+1284.62%)
Mutual labels:  compile
Rebar3
Erlang build tool that makes it easy to compile and test Erlang applications and releases.
Stars: ✭ 1,295 (+9861.54%)
Mutual labels:  compile
tools.build
Clojure builds as Clojure programs
Stars: ✭ 153 (+1076.92%)
Mutual labels:  compile
Compile Hero
πŸ”°Visual Studio Code Extension For Compiling Language
Stars: ✭ 169 (+1200%)
Mutual labels:  compile
xconfigure
High-Performance configuration patterns and recipes.
Stars: ✭ 42 (+223.08%)
Mutual labels:  compile
Compiler Util
An NX utility, responsible for executing code in the context of an object.
Stars: ✭ 130 (+900%)
Mutual labels:  compile
Runtimecompiledcplusplus
Change C++ code at runtime
Stars: ✭ 1,843 (+14076.92%)
Mutual labels:  compile
Snapdragon
snapdragon is an extremely pluggable, powerful and easy-to-use parser-renderer factory.
Stars: ✭ 180 (+1284.62%)
Mutual labels:  compile
Lazy Compile Webpack Plugin
Boost webpack startup time by lazily compiling dynamic imports
Stars: ✭ 106 (+715.38%)
Mutual labels:  compile
golden
a benchmark for compile-time and/or runtime Nim πŸ†
Stars: ✭ 28 (+115.38%)
Mutual labels:  compile
Tutorial Ubuntu 18.04 Install Nvidia Driver And Cuda And Cudnn And Build Tensorflow For Gpu
Ubuntu 18.04 How to install Nvidia driver + CUDA + CUDNN + build tensorflow for gpu step by step command line
Stars: ✭ 91 (+600%)
Mutual labels:  compile
Compileflow
core business process engine of Alibaba Halo platform. best engine for trade Scenes
Stars: ✭ 179 (+1276.92%)
Mutual labels:  compile
opencv3-setup
Raspberry Pi whiptail Menu driven Easy Install and Compile of opencv3 python from source files.
Stars: ✭ 47 (+261.54%)
Mutual labels:  compile
LL-Script
Simple script
Stars: ✭ 38 (+192.31%)
Mutual labels:  compile
Kotlin Compile Testing
A library for testing Kotlin and Java annotation processors, compiler plugins and code generation
Stars: ✭ 245 (+1784.62%)
Mutual labels:  compile

go-script

Go library facilitating the creation of programs that resemble bash scripts.

Rationale

Go's advantages like static binding and a huge modern standard library do suggest its usage for little tools that used to be implemented as shell scripts.

This library is intended as a wrapper for typical tasks shell scripts include and aimed at bringing the LOC size closer to unparalleled bash shortness.

go-script uses several other libraries that enable you to create scripts with a good user feedback and user interface on the command line.

This library strives for a good test coverage even though it is not always easy for user facing code like this.

Methods

GoDoc CircleCI Coverage Status Go Report Card

The methods include helpers for executing external commands (including environment variables), maintaining a working directory, handling files and directories (cp/mv), and evaluating command output (exit code, stdout/stderr). You can use methods for requesting input from users, print progress bars and activity indicators, and use helpers for printing colorful or bold text.

Usage

package main

import (
	"fmt"
	"github.com/jojomi/go-script"
)

func main() {
	sc := script.NewContext()
	sc.MustCommandExist("date")
	sc.SetWorkingDir("/tmp")
	pr := sc.MustExecuteSilent("date", "-R")
	fmt.Print("The current date: ", pr.Output())
	fmt.Println(pr.StateString())
}

More example can be found in the examples directory, execute them like this:

go run examples/command-checking/command-checking.go

Warning

This library's API is not yet stable. Use at your own discretion.

You should be prepared for future API changes of any kind.

In doubt, fork away to keep a certain API status or use vendoring (dep) to keep your desired state.

On The Shoulders or Giants

Libraries Used in go-script

  • go-isatty to detect terminal capabilities

  • survey for user interactions

  • wow for activity indicators

  • pb for progress bars

  • color for printing colorful and bold output

  • go-shutil (forked) for copying data

  • afero for abstracting filesystem for easier testing

Other Libraries

Some libraries have proven highly useful in conjunction with go-script:

More inspiration can be found at awesome-go.

Development

Comments, issues, and of course pull requests are highly welcome.

If you create a Merge Request, be sure to execute ./precommit.sh beforehand.

License

see LICENSE

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].