subshell

package
v12.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package subshell provides facilities to execute CLI commands in subshells.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorDetails

func ErrorDetails(executable string, args []string, err error, output []byte) error

func FormatCommand

func FormatCommand(currentBranch gitdomain.LocalBranchName, omitBranch bool, executable string, args ...string) string

func PrintCommand

func PrintCommand(branch gitdomain.LocalBranchName, omitBranch bool, cmd string, args ...string)

PrintCommand prints the given command-line operation on the console.

Types

type BackendRunner

type BackendRunner struct {
	CommandsCounter *gohacks.Counter
	// If set, runs the commands in the given directory.
	// If not set, runs the commands in the current working directory.
	Dir *string
	// whether to print the executed commands to the CLI
	Verbose bool
}

BackendRunner executes backend shell commands without output to the CLI.

func (BackendRunner) Query

func (self BackendRunner) Query(executable string, args ...string) (string, error)

func (BackendRunner) QueryTrim

func (self BackendRunner) QueryTrim(executable string, args ...string) (string, error)

func (BackendRunner) Run

func (self BackendRunner) Run(executable string, args ...string) error

func (BackendRunner) RunMany

func (self BackendRunner) RunMany(commands [][]string) error

RunMany runs all given commands in current directory. Commands are provided as a list of argv-style strings. Failed commands abort immediately with the encountered error.

type FrontendDryRunner

type FrontendDryRunner struct {
	CommandsCounter  *gohacks.Counter
	GetCurrentBranch GetCurrentBranchFunc
	OmitBranchNames  bool
	PrintCommands    bool
}

FrontendDryRunner prints the given shell commands to the CLI as if they were executed but does not execute them.

func (*FrontendDryRunner) Run

func (self *FrontendDryRunner) Run(executable string, args ...string) error

Run runs the given command in this ShellRunner's directory.

func (*FrontendDryRunner) RunMany

func (self *FrontendDryRunner) RunMany(commands [][]string) error

RunMany runs all given commands in current directory. Commands are provided as a list of argv-style strings. Failed commands abort immediately with the encountered error.

type FrontendRunner

type FrontendRunner struct {
	CommandsCounter  *gohacks.Counter
	GetCurrentBranch GetCurrentBranchFunc
	OmitBranchNames  bool
	PrintCommands    bool
}

FrontendRunner executes frontend shell commands.

func (*FrontendRunner) Run

func (self *FrontendRunner) Run(cmd string, args ...string) (err error)

Run runs the given command in this ShellRunner's directory.

func (*FrontendRunner) RunMany

func (self *FrontendRunner) RunMany(commands [][]string) error

RunMany runs all given commands in current directory. Commands are provided as a list of argv-style strings. Failed commands abort immediately with the encountered error.

type GetCurrentBranchFunc

type GetCurrentBranchFunc func() (gitdomain.LocalBranchName, error)

Jump to

Keyboard shortcuts

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