cli

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DocsRoot

func DocsRoot() *cobra.Command

DocsRoot returns the command tree for generating the command reference.

func Execute

func Execute(ctx context.Context, args []string, env Env) int

Execute runs bam with args and returns the process exit code.

Types

type Backend

type Backend interface {
	provider.Provider
	Probe(ctx context.Context, planKey string) []bamboo.ProbeResult
}

Backend is a server connection: the neutral Provider plus doctor's probe.

type Env

type Env struct {
	Stdin     io.Reader
	Stdout    io.Writer
	Stderr    io.Writer
	Getenv    func(string) string
	StdoutTTY bool
	StderrTTY bool
	StdinTTY  bool
	Width     func() int
	WorkDir   string
	// GitBranch returns the branch checked out in dir; nil means bam cannot
	// tell, and "@" is refused.
	GitBranch func(dir string) (string, error)
	// GitHead returns the commit checked out in dir and whether a remote
	// branch contains it; nil means bam cannot tell.
	GitHead     func(dir string) (sha string, pushed bool, err error)
	Home        string
	Paths       Paths
	Clock       app.Clock
	Keyring     credential.Keyring
	Connect     func(bamboo.Options) (Backend, error)
	OpenBrowser func(url string) error
	// Notify raises a desktop notification; nil, or an error, means this
	// system has none and only the terminal bell rings.
	Notify     func(title, body string) error
	RunPager   func(cmd string, r io.Reader) error
	RunEditor  func(cmd string, initial []byte) ([]byte, error)
	ReadSecret func() (string, error)
	// RunTUI opens the terminal UI. It is a field so tests can assert on the
	// Deps the CLI builds without starting a terminal program.
	RunTUI func(context.Context, tui.Deps) error
	GOOS   string
	// Glob is filepath.Glob; nil matches nothing. It finds the Windows
	// presets file from WSL.
	Glob func(pattern string) ([]string, error)
	// WindowsHome returns the Windows home as a WSL path. It is asked only in
	// WSL, when bam creates the presets file.
	WindowsHome func() (string, error)
}

Env is everything the CLI takes from the process. Tests build it by hand.

func SystemEnv

func SystemEnv() Env

SystemEnv returns the Env of the running process.

type Paths

type Paths struct {
	MachineConfig string
	Credentials   string
	Capabilities  string
	State         string
	Usage         string // the private tally of commands run, one small file
	Sets          string // directory of set run records and locks
	Trees         string // directory of saved build trees, one file per server
	AgentJobs     string // directory of the jobs each agent can run, one file per server
	// LegacyConfigDir is where bam kept its config before it used
	// ~/.config/bam on every platform; Execute moves files from it. Empty
	// means nothing to move.
	LegacyConfigDir string
}

Paths are bam's files outside the repository.

Jump to

Keyboard shortcuts

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