base

package
v0.8.18 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2026 License: MPL-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package base defines the core CLI framework, lifecycle hooks, and initialization routines for earth.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CLI

type CLI struct {
	// contains filtered or unexported fields
}

CLI contains the common "earth" command line interface.

func NewCLI

func NewCLI(console conslogging.ConsoleLogger, opts ...CLIOpt) *CLI

NewCLI creates a new CLI.

func (*CLI) AddDeferredFunc

func (c *CLI) AddDeferredFunc(f func())

AddDeferredFunc adds a function to be executed after the app is run.

func (*CLI) App

func (c *CLI) App() *cli.Command

App returns the app's cli.Command.

func (*CLI) BuiltBy

func (c *CLI) BuiltBy() string

BuiltBy returns the "built by" string.

func (*CLI) Cfg

func (c *CLI) Cfg() *config.Config

Cfg returns the config.

func (*CLI) CommandName

func (c *CLI) CommandName() string

CommandName returns the command name.

func (*CLI) Console

func (c *CLI) Console() conslogging.ConsoleLogger

Console returns the console logger.

func (*CLI) DefaultBuildkitdImage

func (c *CLI) DefaultBuildkitdImage() string

DefaultBuildkitdImage returns the default buildkitd image.

func (*CLI) DefaultInstallationName

func (c *CLI) DefaultInstallationName() string

DefaultInstallationName returns the default installation name.

func (*CLI) ExecuteDeferredFuncs

func (c *CLI) ExecuteDeferredFuncs()

ExecuteDeferredFuncs executes all deferred functions.

func (*CLI) Flags

func (c *CLI) Flags() *flag.Global

Flags returns the global flags.

func (*CLI) GetBuildkitClient

func (cli *CLI) GetBuildkitClient(ctx context.Context, cmd *cli.Command) (c *client.Client, err error)

GetBuildkitClient returns a Buildkit client.

func (*CLI) GitSHA

func (c *CLI) GitSHA() string

GitSHA returns the git sha.

func (*CLI) InitFrontend

func (cli *CLI) InitFrontend(_ context.Context, cmd *cli.Command) error

InitFrontend initializes the frontend for the given command.

func (*CLI) Logbus

func (c *CLI) Logbus() *logbus.Bus

Logbus returns the logbus.

func (*CLI) LogbusSetup

func (c *CLI) LogbusSetup() *setup.BusSetup

LogbusSetup returns the logbus setup.

func (*CLI) SetAction

func (c *CLI) SetAction(action cli.ActionFunc)

SetAction sets the action of the app.

func (*CLI) SetAppStopOnNthArg added in v0.8.18

func (c *CLI) SetAppStopOnNthArg(stop *int)

SetAppStopOnNthArg tells the cli that it should stop processing flags after the Nth argument.

func (*CLI) SetAppUsage

func (c *CLI) SetAppUsage(usage string)

SetAppUsage sets the usage text of the app.

func (*CLI) SetAppUsageText

func (c *CLI) SetAppUsageText(usageText string)

SetAppUsageText sets the extended usage text of the app.

func (*CLI) SetAppUseShortOptionHandling

func (c *CLI) SetAppUseShortOptionHandling(use bool)

SetAppUseShortOptionHandling sets whether the app should use short option handling.

func (*CLI) SetBefore

func (c *CLI) SetBefore(before cli.BeforeFunc)

SetBefore sets the before function of the app.

func (*CLI) SetCfg

func (c *CLI) SetCfg(cfg *config.Config)

SetCfg sets the config.

func (*CLI) SetCommandName

func (c *CLI) SetCommandName(commandName string)

SetCommandName sets the command name.

func (*CLI) SetCommands

func (c *CLI) SetCommands(commands []*cli.Command)

SetCommands sets the subcommands of the app.

func (*CLI) SetConsole

func (c *CLI) SetConsole(cons conslogging.ConsoleLogger)

SetConsole sets the console logger.

func (*CLI) SetFlags

func (c *CLI) SetFlags(flags []cli.Flag)

SetFlags sets the flags of the app.

func (*CLI) SetLogbus

func (c *CLI) SetLogbus(logbus *logbus.Bus)

SetLogbus sets the logbus.

func (*CLI) SetLogbusSetup

func (c *CLI) SetLogbusSetup(setup *setup.BusSetup)

SetLogbusSetup sets the logbus setup.

func (*CLI) SetVersion

func (c *CLI) SetVersion(version string)

SetVersion sets the version of the app.

func (*CLI) Version

func (c *CLI) Version() string

Version returns the version.

type CLIOpt

type CLIOpt func(CLI) CLI

CLIOpt is a functional option for configuring a CLI.

func WithBuiltBy

func WithBuiltBy(builtby string) CLIOpt

WithBuiltBy sets the built by string of the CLI.

func WithDefaultBuildkitdImage

func WithDefaultBuildkitdImage(image string) CLIOpt

WithDefaultBuildkitdImage sets the default buildkitd image of the CLI.

func WithDefaultInstallationName

func WithDefaultInstallationName(name string) CLIOpt

WithDefaultInstallationName sets the default installation name of the CLI.

func WithGitSHA

func WithGitSHA(sha string) CLIOpt

WithGitSHA sets the git sha of the CLI.

func WithVersion

func WithVersion(version string) CLIOpt

WithVersion sets the version of the CLI.

Jump to

Keyboard shortcuts

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