cmdx

package module
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: MIT Imports: 9 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Chdir added in v0.1.1

func Chdir(dir string) (func() error, error)

func CheckErr

func CheckErr(err error, msg ...string)

func CommandIsExist

func CommandIsExist(cmd string) bool

func Green added in v0.1.1

func Green(format string, a ...any)

func MustChdir added in v0.1.1

func MustChdir(dir string) func()

func MustRun

func MustRun(format string, a ...any)

MustRun ...

func MustSHRun

func MustSHRun(format string, a ...any)

MustSHRun ...

func Normal added in v0.1.1

func Normal(format string, a ...any)

func Recover added in v0.1.1

func Recover(r any)

func Red added in v0.1.1

func Red(format string, a ...any)

func Run

func Run(format string, a ...any) error

Run ...

func RunCombinedOutput

func RunCombinedOutput(cmd string, envs []string) (string, error)

RunCombinedOutput ...

func SHRun added in v0.1.6

func SHRun(format string, a ...any) error

func Set added in v0.1.1

func Set(s ISet)

func Throw added in v0.1.1

func Throw(format string, a ...any)

func ToCommand

func ToCommand(cmd string) *exec.Cmd

ToCommand transfer a string to command object

func WrapCli added in v0.1.4

func WrapCli(cli ICli)

func WrapCobra added in v0.1.4

func WrapCobra(cobra ICobra)

func Yellow added in v0.1.1

func Yellow(format string, a ...any)

Types

type CMD added in v0.1.1

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

CMD wrap origin cmd structure

func New added in v0.1.1

func New(format string, a ...any) *CMD

New ...

func New2 added in v0.1.1

func New2(cmd *exec.Cmd) *CMD

New2 ...

func (*CMD) Dir added in v0.1.2

func (c *CMD) Dir(dir string) *CMD

Dir set command workdir

func (*CMD) Env added in v0.1.2

func (c *CMD) Env(envs ...string) *CMD

Env set environment variables

func (*CMD) Input added in v0.1.2

func (c *CMD) Input(in io.Reader) *CMD

Input ...

func (*CMD) Output added in v0.1.2

func (c *CMD) Output(output, errput io.Writer) *CMD

Output ...

func (*CMD) Run added in v0.1.1

func (c *CMD) Run() error

Run ...

func (*CMD) Timeout added in v0.1.2

func (c *CMD) Timeout(t time.Duration) *CMD

Timeout ...

type DefaultPrint added in v0.1.1

type DefaultPrint struct{}

DefaultPrint ...

func (*DefaultPrint) Green added in v0.1.1

func (d *DefaultPrint) Green(format string, a ...any)

Green ...

func (*DefaultPrint) Normal added in v0.1.1

func (d *DefaultPrint) Normal(format string, a ...any)

Normal ...

func (*DefaultPrint) Red added in v0.1.1

func (d *DefaultPrint) Red(format string, a ...any)

Red ...

func (*DefaultPrint) Yellow added in v0.1.1

func (d *DefaultPrint) Yellow(format string, a ...any)

Yellow ...

type DefaultSet added in v0.1.1

type DefaultSet struct {
	IPrint
}

DefaultSet ...

func (*DefaultSet) CheckErr added in v0.1.1

func (d *DefaultSet) CheckErr(err error, msg ...string)

CheckErr ...

func (*DefaultSet) Recover added in v0.1.1

func (d *DefaultSet) Recover(r interface{})

Recover ...

func (*DefaultSet) Throw added in v0.1.1

func (d *DefaultSet) Throw(format string, a ...any)

Throw ...

type Err added in v0.1.1

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

Err ...

type ICli added in v0.1.4

type ICli interface {
	Run(arguments []string) (err error) // for urfave/cli
}

type ICobra added in v0.1.4

type ICobra interface {
	Execute() error
}

type IPrint added in v0.1.1

type IPrint interface {
	Normal(format string, a ...any)
	Green(format string, a ...any)
	Yellow(format string, a ...any)
	Red(format string, a ...any)
}

IPrint ...

type ISet added in v0.1.1

type ISet interface {
	IPrint

	CheckErr(err error, msg ...string)
	Throw(format string, a ...any)
	Recover(r any)
}

ISet settings of cmdx

Jump to

Keyboard shortcuts

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