command

package
v0.19.765 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultEnv

func DefaultEnv() map[string]string

func IsTTY

func IsTTY() bool

IsTTY checks if the current stdin is a TTY

func New

func New(v *validator.Validate, opts ...commandOption) (*command, error)

func ParseCommand

func ParseCommand(str string) (string, []string, map[string]string, error)

func SetQuietMode

func SetQuietMode(val bool)

SetQuietMode is a global variable that will control the entire output of this package until set otherwise. If set to true, we write all logs to io.Discard, instead of stderr/stdout.

func WithArgs

func WithArgs(args []string) commandOption

WithArgs sets the arguments passed to the commands

func WithCmd

func WithCmd(c string) commandOption

WithCmd sets the command that will be run

func WithCwd

func WithCwd(cwd string) commandOption

WithCwd sets cwd

func WithEnv

func WithEnv(env map[string]string) commandOption

WithEnv sets the environment to run the command within

func WithFileOutput

func WithFileOutput(fp string) commandOption

func WithInheritedEnv

func WithInheritedEnv() commandOption

WithInheritedEnv automatically inherits the existing environment

func WithLineColor

func WithLineColor(color *color.Color) commandOption

func WithLinePrefix

func WithLinePrefix(prefix string) commandOption

func WithLinePrefixFn

func WithLinePrefixFn(fn func() string) commandOption

func WithProcessGroup

func WithProcessGroup() commandOption

func WithStderr

func WithStderr(fw io.Writer) commandOption

WithStderr sets the stderr

func WithStdin

func WithStdin(fw io.Reader) commandOption

WithStdin sets the stderr

func WithStdout

func WithStdout(fw io.Writer) commandOption

WithStdout sets the stdout

func WithTTYAwareEnv

func WithTTYAwareEnv(env map[string]string) commandOption

WithTTYAwareEnv combines WithInheritedEnv with additional environment variables

func WithTTYAwareStdin

func WithTTYAwareStdin() commandOption

WithTTYAwareStdin sets stdin based on TTY detection

Types

This section is empty.

Jump to

Keyboard shortcuts

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