cli

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Command

func Command(command string, args ...string) *exec.Cmd

Command creates a new command.

func CommandInteractive

func CommandInteractive(command string, args ...string) *exec.Cmd

CommandInteractive creates a new interactive command.

func DryRun

func DryRun(d bool)

DryRun toggles the state of the command runner. If true, commands are only printed to the console without execution.

func Prompt

func Prompt(question string) bool

Prompt prompts for input with a question. It returns true only if answer is y or Y.

Types

type ActiveCommandChain

type ActiveCommandChain struct {
	// contains filtered or unexported fields
}

ActiveCommandChain is an active command chain.

func (*ActiveCommandChain) Add

func (a *ActiveCommandChain) Add(f func() error)

Add adds a new function to the runner.

func (ActiveCommandChain) Exec

func (a ActiveCommandChain) Exec() error

Exec executes the command chain. The first errored function terminates the chain and the error is returned. Otherwise, returns nil.

func (*ActiveCommandChain) Stage

func (a *ActiveCommandChain) Stage(s string)

Stage sets the current stage of the runner.

func (*ActiveCommandChain) Stagef

func (a *ActiveCommandChain) Stagef(format string, s ...interface{})

Stagef is like stage with string format.

type CommandChain

type CommandChain interface {
	// Init initiates a new runner using the current instance.
	Init() *ActiveCommandChain
	// Logger returns the instance logger.
	Logger() *log.Entry
}

CommandChain is a chain of commands. commands are executed in order.

func New

func New(name string) CommandChain

New creates a new runner instance.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL