All Projects → alexellis → Go Execute

alexellis / Go Execute

Licence: mit
Automate CLI commands with Go

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Labels

Projects that are alternatives of or similar to Go Execute

Colored
🎨 Mirror of colored library repository
Stars: ✭ 98 (-5.77%)
Mutual labels:  library
Ahk Rare
My collection of rare and maybe very useful functions
Stars: ✭ 101 (-2.88%)
Mutual labels:  library
Datepicker
A Date Picker with Calendar for iPhone and iPad Apps.
Stars: ✭ 103 (-0.96%)
Mutual labels:  library
Digitalkeyboard
手动实现简单的身份证数字键盘
Stars: ✭ 99 (-4.81%)
Mutual labels:  library
Timeline Chart View
An android view to represent data over a timeline.
Stars: ✭ 100 (-3.85%)
Mutual labels:  library
Protobuf
Python implementation of Protocol Buffers data types with dataclasses support
Stars: ✭ 101 (-2.88%)
Mutual labels:  library
React Markdown
Markdown editor (input) based on React
Stars: ✭ 98 (-5.77%)
Mutual labels:  library
Manuf
Parser library for Wireshark's OUI database.
Stars: ✭ 103 (-0.96%)
Mutual labels:  library
Mime
The Hoa\Mime library.
Stars: ✭ 100 (-3.85%)
Mutual labels:  library
Pdfbox
Mirror of Apache PDFBox
Stars: ✭ 1,384 (+1230.77%)
Mutual labels:  library
React Native Create Library
📓 Command line tool to create a React Native library with a single command
Stars: ✭ 1,362 (+1209.62%)
Mutual labels:  library
Gl Catmull Clark
A javascript implementation of the Catmull-Clark subdivision surface algorithm
Stars: ✭ 100 (-3.85%)
Mutual labels:  library
Charcoal Ios
A modern way to filter things in your iOS apps
Stars: ✭ 102 (-1.92%)
Mutual labels:  library
Sunset.css
This library offers a collection of different CSS-powered transitions.
Stars: ✭ 99 (-4.81%)
Mutual labels:  library
Ts3admin.class
The ts3admin.class is a powerful api for communication with Teamspeak 3 Servers from your website! Your creativity knows no bounds!
Stars: ✭ 103 (-0.96%)
Mutual labels:  library
Geotic
Entity Component System library for javascript
Stars: ✭ 97 (-6.73%)
Mutual labels:  library
Gifdec
small C GIF decoder
Stars: ✭ 100 (-3.85%)
Mutual labels:  library
Freeradius Client
A BSD licenced RADIUS client library
Stars: ✭ 103 (-0.96%)
Mutual labels:  library
Simplepie
A simple Atom/RSS parsing library for PHP.
Stars: ✭ 1,389 (+1235.58%)
Mutual labels:  library
Coq Ext Lib
A library of Coq definitions, theorems, and tactics. [[email protected],@liyishuai]
Stars: ✭ 102 (-1.92%)
Mutual labels:  library

go-execute

A simple wrapper for Go's command execution packages.

go get github.com/alexellis/go-execute/pkg/v1

Docs

See Godoc github.com/alexellis/go-execute

go-execute users

Feel free to add a link to your own projects in a PR.

Example of exec without streaming to STDIO

This example captures the values from stdout and stderr without relaying to the console. This means the values can be inspected and used for automation.

package main

import (
	"fmt"

	execute "github.com/alexellis/go-execute/pkg/v1"
)

func main() {
	cmd := execute.ExecTask{
		Command:     "docker",
		Args:        []string{"version"},
		StreamStdio: false,
	}

	res, err := cmd.Execute()
	if err != nil {
		panic(err)
	}

	if res.ExitCode != 0 {
		panic("Non-zero exit code: " + res.Stderr)
	}

	fmt.Printf("stdout: %s, stderr: %s, exit-code: %d\n", res.Stdout, res.Stderr, res.ExitCode)
}

Example with "shell" and exit-code 0

package main

import (
	"fmt"

	execute "github.com/alexellis/go-execute/pkg/v1"
)

func main() {
	ls := execute.ExecTask{
		Command: "ls",
		Args:    []string{"-l"},
		Shell:   true,
	}
	res, err := ls.Execute()
	if err != nil {
		panic(err)
	}

	fmt.Printf("stdout: %q, stderr: %q, exit-code: %d\n", res.Stdout, res.Stderr, res.ExitCode)
}

Example with "shell" and exit-code 1

package main

import (
	"fmt"

	execute "github.com/alexellis/go-execute/pkg/v1"
)

func main() {
	ls := execute.ExecTask{
		Command: "exit 1",
		Shell:   true,
	}
	res, err := ls.Execute()
	if err != nil {
		panic(err)
	}

	fmt.Printf("stdout: %q, stderr: %q, exit-code: %d\n", res.Stdout, res.Stderr, res.ExitCode)
}

Contributing

Commits must be signed off with git commit -s

License: MIT

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].