subshell

package
v9.0.1 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: MIT Imports: 8 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 string, omitBranch bool, executable string, args ...string) string

func PrintCommand

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

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

Types

type BackendRunner

type BackendRunner struct {
	// If set, runs the commands in the given directory.
	// If not set, runs the commands in the current working directory.
	Dir   *string
	Stats Statistics
	// 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 (r BackendRunner) Query(executable string, args ...string) (string, error)

func (BackendRunner) Run

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

func (BackendRunner) RunMany

func (r 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 {
	CurrentBranch   *cache.String
	OmitBranchNames bool
	Stats           Statistics
}

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

func (*FrontendDryRunner) Run

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

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

func (*FrontendDryRunner) RunMany

func (r *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 {
	CurrentBranch   *cache.String
	OmitBranchNames bool
	Stats           Statistics
}

FrontendRunner executes frontend shell commands.

func (*FrontendRunner) Run

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

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

func (*FrontendRunner) RunMany

func (r *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 Statistics

type Statistics interface {
	RegisterRun()
}

Jump to

Keyboard shortcuts

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