subshell

package
v22.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Overview

Package subshell provides facilities to execute CLI commands in subshells.

Index

Constants

View Source
const TestToken = "GIT_TOWN_TEST"

Variables

This section is empty.

Functions

func ErrorDetails

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

func FormatCommand

func FormatCommand(location gitdomain.Location, printBranch bool, env []string, executable string, args ...string) string

func IsInTest

func IsInTest() bool

func PrintCommand

func PrintCommand(location gitdomain.Location, 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

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

type FrontendDryRunner

type FrontendDryRunner struct {
	Backend          subshelldomain.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

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

type FrontendRunner

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

FrontendRunner executes frontend shell commands.

func (*FrontendRunner) Run

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

func (*FrontendRunner) RunWithEnv

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

type GetCurrentBranchFunc

type GetCurrentBranchFunc func(subshelldomain.Querier) (Option[gitdomain.LocalBranchName], error)

type GetCurrentSHAFunc

type GetCurrentSHAFunc func(subshelldomain.Querier) (gitdomain.SHA, error)

Directories

Path Synopsis
Package subshelldomain defines types around subshells.
Package subshelldomain defines types around subshells.

Jump to

Keyboard shortcuts

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