GithubHelp home page GithubHelp logo

brev-go-cli's Introduction

Brev CLI

Distribute to Homebrew

Step 1: bump version (see top of Makefile)

Step 2: create homebrew distribution

> API_COTTER_KEY=... make dist-homebrew

Step 3: create GitHub release

Step 4: upload resultant tar.gz to GitHub release

Step 5: copy sha256 (output from step 2) and use it in a new update to https://github.com/brevdev/homebrew-tap

Completions

To get completion to work:

brev completion bash > /usr/local/etc/bash_completion.d/brev

// this may not be needed echo "autoload -U compinit; compinit" >> ~/.zshrc

brev completion zsh > "${fpath[1]}/_brev"

brev-go-cli's People

Contributors

drewmalin avatar naderkhalil avatar

Watchers

 avatar  avatar  avatar

brev-go-cli's Issues

Enhance Command Context to Include Colorized Output

This looks great!

Question on uptake -- what if we changed "CommandContext" to just be "Terminal" (or "CLI"?) and wrapped some of the colorization along with the writers, e.g.:

type Terminal struct {
	out     io.Writer
	verbose io.Writer
	err     io.Writer

	Green  func(format string, a ...interface{}) string
	Yellow func(format string, a ...interface{}) string
	Red    func(format string, a ...interface{}) string
}

func NewTerminal() *Terminal {
	return &Terminal{
		out:     os.Stdout,
		verbose: os.Stdout,
		Green:   color.New(color.FgGreen).SprintfFunc(),
		Yellow:  color.New(color.FgYellow).SprintfFunc(),
		Red:     color.New(color.FgRed).SprintfFunc(),
	}
}
func (t *Terminal) Outln(message string) {
	fmt.Fprint(c.out, message+"\n")
}

func (t *Terminal) Verboseln(message string) {
	fmt.Fprint(c.verbose, message+"\n")
}

func (t *Terminal) Errln(message string) {
	fmt.Fprint(c.err, message+"\n")
}

Then uptake would look something like:

func main() {
	// all the initial setup in the root cmd tree
	t := NewTerminal()
	FooBar(t)
}

func FooBar(t *Terminal) {
	t.Outln(t.Green("Hey this is green\n") + t.Yellow("And this is yellow"))

	t.Errln(t.Red("This is an err so it's red!") + "\nBut here is some helper text that is uncolored")
}

Originally posted by @drewmalin in #42 (comment)

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.