cmd

package
v0.0.0-...-136e5b9 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 26 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version = "dev"

Version remains only as a compatibility fallback for older build scripts. New release builds inject main.version and pass it through BuildInfo.

Functions

func Execute

func Execute(build ...BuildInfo) error

Execute builds a fresh command tree on every call. main should handle the returned error and map it to a process exit code.

func ExecuteContext

func ExecuteContext(ctx context.Context, deps Dependencies, info BuildInfo, args []string) error

func ExitCode

func ExitCode(err error) int

func NewRootCommand

func NewRootCommand(deps Dependencies, info BuildInfo) *cobra.Command

func RenderHello

func RenderHello(info BuildInfo, latestVersion string, hasUpdate bool, useColor bool) string

RenderHello returns the complete left-aligned hello window as a string, framed by exactly one leading and one trailing blank line. The caller is responsible for writing it.

func RenderHelpDocs

func RenderHelpDocs(command *cobra.Command)

func RenderHelpTree

func RenderHelpTree(command *cobra.Command, maxDepth int, showGlobalFlags bool)

func WriteFinalRecovery

func WriteFinalRecovery(err error, out io.Writer) bool

WriteFinalRecovery writes an upgrade recovery block after the ordinary error diagnostic so the directly executable installer command is the final output.

Types

type BuildInfo

type BuildInfo struct {
	Version   string `json:"version"`
	Commit    string `json:"commit,omitempty"`
	BuildDate string `json:"build_date,omitempty"`
	Target    string `json:"target,omitempty"`
}

type Dependencies

type Dependencies struct {
	In               io.Reader
	Out              io.Writer
	Err              io.Writer
	Getwd            func() (string, error)
	HomeDir          func() (string, error)
	Runner           versioning.Runner
	HookRunner       hooks.CommandRunner
	HTTPClient       *http.Client
	Now              func() time.Time
	Executable       func() (string, error)
	ReadUpdateNotice func(string, time.Time) string
	LaunchUpdate     func(string, string) error
	ConsumeUpgrade   func() (*updater.Completion, error)
	ReconcileUpgrade func(string) error
	ReconcileBinary  func(string, string) error
	BootstrapAgents  func(string) error
	IsTerminal       func() bool
}

Jump to

Keyboard shortcuts

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