command

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cmd

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

func InitCmd added in v1.3.0

func InitCmd(input string) Cmd

Initializes a new instance of the command, already setting the command to run

func (Cmd) CombinedOut added in v1.3.0

func (sh Cmd) CombinedOut() (string, error)

Execute the command with all parameters already set, something like "exec.Command([formatted command]).CombinedOutput()" and return its error and string output, as well as executing with output to stdin,stdout and stderr.

func (*Cmd) CustomCmdFlags added in v1.3.0

func (sh *Cmd) CustomCmdFlags(flags string)

It sets the customized cmd flags, its syntax when executed would be something like this "cmd.exe [flags] /c command".

func (*Cmd) CustomPSFlags added in v1.3.0

func (sh *Cmd) CustomPSFlags(flags string)

It sets the customized powershell flags, its syntax when executed would be something like this "powershell.exe [flags] /c command".

func (*Cmd) CustomStd added in v1.3.0

func (sh *Cmd) CustomStd(Stdin, Stdout, Stderr bool)

Set custom Stdin,Stdout,Stderr in one function

func (Cmd) GetExec added in v1.3.1

func (sh Cmd) GetExec() *exec.Cmd

Returns the exec.Cmd structure with all parameters already configured

func (*Cmd) HideCmdWindow added in v1.3.0

func (sh *Cmd) HideCmdWindow(set bool)

Hides the cmd/powershell window that appears when executing a command in go.

func (Cmd) Out added in v1.3.0

func (sh Cmd) Out() (string, error)

Execute the command with all the parameters already set, something like "exec.Command([formatted command]).Output()" and return its string and error output

func (Cmd) Run added in v1.3.0

func (sh Cmd) Run() error

Execute the command with all the parameters already set, something like "exec.Command([formatted command]).Run()" and return its error output

func (*Cmd) RunWithPS added in v1.3.0

func (sh *Cmd) RunWithPS(set bool)

Run the command using "powershell.exe [parameters] /c command" instead of "cmd.exe [parameters] /c command"

func (*Cmd) RunWithoutCmd added in v1.3.0

func (sh *Cmd) RunWithoutCmd(set bool)

Execute the command directly, it is useful if you want to execute a binary, this mode does not have access to the path so you will have to put the full path of the binary or use something relative to execute it.

func (Cmd) SetAndCombinedOut added in v1.3.0

func (sh Cmd) SetAndCombinedOut(command string) (string, error)

It is the same as cmd := command.Cmd("<command>"); cmd.CombinedOut() but in a single argument, what it does is to put an internal input (the one provided) and execute it directly without affecting the main structure.

func (Cmd) SetAndOut added in v1.3.0

func (sh Cmd) SetAndOut(command string) (string, error)

It is the same as cmd := command.Cmd("<command>"); cmd.Out() but in a single argument, what it does is to put an internal input (the one provided) and execute it directly without affecting the main structure.

func (Cmd) SetAndRun added in v1.3.0

func (sh Cmd) SetAndRun(command string) error

It is the same as cmd := command.Cmd("<command>"); cmd.Run() but in a single argument, what it does is to put an internal input (the one provided) and execute it directly without affecting the main structure.

func (Cmd) SetAndStart added in v1.3.0

func (sh Cmd) SetAndStart(command string) error

It is the same as cmd := command.Cmd("<command>"); cmd.Start() but in a single argument, what it does is to put an internal input (the one provided) and execute it directly without affecting the main structure.

func (*Cmd) SetInput added in v1.3.0

func (sh *Cmd) SetInput(input string)

Set the command to be executed

func (*Cmd) SetPath added in v1.3.0

func (sh *Cmd) SetPath(path string)

Set the running path of the command

func (Cmd) Start added in v1.3.0

func (sh Cmd) Start() error

Execute the command with all the parameters already set, something like "exec.Command([formatted command]).Start()" and return its error output

func (*Cmd) Stderr added in v1.3.0

func (sh *Cmd) Stderr(set bool)

Set the individual Stderr

func (*Cmd) Stdin added in v1.3.0

func (sh *Cmd) Stdin(set bool)

Set the individual Stdin

func (*Cmd) Stdout added in v1.3.0

func (sh *Cmd) Stdout(set bool)

Set the individual Stdout

Jump to

Keyboard shortcuts

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