too

package
v0.0.0-...-16f1eb7 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const Description = `Mix multiple commands stream and interruptions`

Description ...

Variables

View Source
var AppEnd = Message{Output: -1}

AppEnd ...

View Source
var FlagCommand = cli.StringSliceFlag{
	Name:  "cmd",
	Usage: "commands to be mixed",
}

FlagCommand can accept commands to be mixed in one-line

View Source
var FlagFile = cli.StringFlag{
	Name:  "f",
	Usage: "commads from a config file",
}

Functions

func Exec

func Exec(output io.Writer, commands ...*Command) error

Exec ...

func MainAction

func MainAction(ctx *cli.Context, stdin io.Reader) error

MainAction ...

func NewApp

func NewApp() *cli.App

NewApp ...

Types

type Builder

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

Builder ...

func NewBuilder

func NewBuilder(stdin io.Reader) *Builder

NewBuilder ...

func (*Builder) Accept

func (b *Builder) Accept() error

Accept ...

func (*Builder) Add

func (b *Builder) Add(line string) error

Add ...

func (*Builder) Build

func (b *Builder) Build() []*Command

Build ...

type Command

type Command struct {
	Color    *color.Color
	Index    int
	Prefix   string
	RawInput string
	*exec.Cmd
	// contains filtered or unexported fields
}

Command ...

func NewCommand

func NewCommand(line string, index int, col *color.Color) *Command

NewCommand ...

func (*Command) ExitCode

func (c *Command) ExitCode() Message

ExitCode ...

func (*Command) Introduction

func (c *Command) Introduction() Message

Introduction prints raw input with underline.

func (*Command) Start

func (c *Command) Start(msg chan<- Message, end chan *Command) error

Start ...

type ConfigV1

type ConfigV1 struct {
	Version  string `json:"version" yaml:"version"`
	Commands []struct {
		Name string            `json:"name" yaml:"name"`
		Run  string            `json:"run" yaml:"run"`
		Env  map[string]string `json:"env" yaml:"env"`
	} `json:"commands" yaml:"commands"`
}

func Parse

func Parse(fpath string) (c ConfigV1, err error)

type ErrorInterrupted

type ErrorInterrupted struct {
	CommandErrors []error
}

ErrorInterrupted ...

func (ErrorInterrupted) Add

func (e ErrorInterrupted) Add(bin string, err error)

Add command specific errors.

func (ErrorInterrupted) Error

func (e ErrorInterrupted) Error() string

Error to satisfy error interface.

type Message

type Message struct {
	Output Output
	Color  *color.Color
	Header string
	Text   string
}

Message ...

func (Message) Print

func (m Message) Print(out io.Writer)

Print ...

type Output

type Output int

Output ...

const (
	// Stdout ...
	Stdout Output = iota + 1
	// Stderr ...
	Stderr
)

Jump to

Keyboard shortcuts

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