command

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 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 WinCmd

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

func Cmd

func Cmd(input string) WinCmd

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

func GetStruct

func GetStruct() *WinCmd

func (WinCmd) CombinedOut

func (sh WinCmd) 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 (*WinCmd) CustomCmdFlags

func (sh *WinCmd) CustomCmdFlags(flags string)

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

func (*WinCmd) CustomPSFlags

func (sh *WinCmd) CustomPSFlags(flags string)

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

func (*WinCmd) CustomStd

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

Set custom Stdin,Stdout,Stderr in one function

func (*WinCmd) HideCmdWindow

func (sh *WinCmd) HideCmdWindow(set bool)

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

func (WinCmd) Out

func (sh WinCmd) 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 (WinCmd) Run

func (sh WinCmd) Run() error

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

func (*WinCmd) RunWithPS

func (sh *WinCmd) RunWithPS(set bool)

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

func (*WinCmd) RunWithoutCmd

func (sh *WinCmd) 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 (WinCmd) SetAndCombinedOut

func (sh WinCmd) 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 (WinCmd) SetAndOut

func (sh WinCmd) 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 (WinCmd) SetAndRun

func (sh WinCmd) 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 (WinCmd) SetAndStart

func (sh WinCmd) 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 (*WinCmd) SetInput

func (sh *WinCmd) SetInput(input string)

Set the command to be executed

func (*WinCmd) SetPath

func (sh *WinCmd) SetPath(path string)

Set the running path of the command

func (WinCmd) Start

func (sh WinCmd) Start() error

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

func (*WinCmd) Stderr

func (sh *WinCmd) Stderr(set bool)

Set the individual Stderr

func (*WinCmd) Stdin

func (sh *WinCmd) Stdin(set bool)

Set the individual Stdin

func (*WinCmd) Stdout

func (sh *WinCmd) 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