subshell

package
v20.2.0 Latest Latest
Warning

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

Go to latest
Published: May 15, 2025 License: MIT Imports: 18 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, printBranch bool, env []string, executable string, args ...string) string

func PrintCommand

func PrintCommand(branch gitdomain.LocalBranchName, printBranch bool, env []string, cmd string, args ...string)

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

Types

type BackendRunner

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

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) RunWithEnv added in v20.2.0

func (self BackendRunner) RunWithEnv(env []string, executable string, args ...string) error

type FrontendDryRunner

type FrontendDryRunner struct {
	Backend          gitdomain.Querier
	CommandsCounter  Mutable[gohacks.Counter]
	GetCurrentBranch GetCurrentBranchFunc
	PrintBranchNames 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(cmd string, args ...string) error

func (*FrontendDryRunner) RunWithEnv added in v20.2.0

func (self *FrontendDryRunner) RunWithEnv(env []string, cmd string, args ...string) error

type FrontendRunner

type FrontendRunner struct {
	Backend          gitdomain.Querier
	CommandsCounter  Mutable[gohacks.Counter]
	GetCurrentBranch GetCurrentBranchFunc
	PrintBranchNames bool
	PrintCommands    bool
}

FrontendRunner executes frontend shell commands.

func (*FrontendRunner) Run

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

func (*FrontendRunner) RunWithEnv added in v20.2.0

func (self *FrontendRunner) RunWithEnv(env []string, cmd string, args ...string) error

type GetCurrentBranchFunc

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

Jump to

Keyboard shortcuts

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