Help us shape the future of Go! Take the 2026 Go Developer Survey

cli_entrypoint

package
v0.57.28 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

ConfigSetFuncFromFS builds a ConfigSetFunc which parses a file in a FS as a ConfigSet.

Functions

func DefaultStatePath

func DefaultStatePath(projectID string) string

DefaultStatePath returns the default state path for the CLI.

func Main

func Main(
	appName string,
	projectID string,
	factories []AddFactoryFunc,
	configSets []BuildConfigSetFunc,
	commandBuilders []BuildCommandsFunc,
	flags []cli.Flag,
)

Main boots the CliBus and runs the CLI application. flags are added to the root flags, so they are accepted before any command.

func StatePathEnvVar

func StatePathEnvVar(projectID string) string

StatePathEnvVar returns the project-specific state path environment variable.

func StatePathEnvVars

func StatePathEnvVars(projectID string) []string

StatePathEnvVars returns the environment variables that override the state path.

Types

type AddFactoryFunc

type AddFactoryFunc = func(b bus.Bus) []controller.Factory

AddFactoryFunc constructs controller factories bound to a host bus.

type BuildCommandsFunc

type BuildCommandsFunc func(getBus func() CliBus) []*cli.Command

BuildCommandsFunc is a function to build CLI commands.

type BuildConfigSetFunc

type BuildConfigSetFunc = plugin_entrypoint.BuildConfigSetFunc

BuildConfigSetFunc is a function to build a list of ConfigSet to apply.

type CliBus

type CliBus interface {
	// GetContext returns the bus context.
	GetContext() context.Context
	// GetBus returns the controller bus.
	GetBus() bus.Bus
	// GetLogger returns the root logger.
	GetLogger() *logrus.Entry
	// GetVolume returns the volume used for state.
	GetVolume() volume.Volume
	// GetWorldEngineID returns the world engine ID.
	GetWorldEngineID() string
	// GetWorldEngine returns the world engine instance.
	GetWorldEngine() world.Engine
	// GetWorldState returns the world state instance.
	GetWorldState() world.WorldState
	// GetPluginHostObjectKey returns the plugin host object key.
	GetPluginHostObjectKey() string
	// AddRelease registers cleanup to run after the bus-owned resources.
	AddRelease(func())
	// Release releases all resources held by the bus.
	Release()
}

CliBus is the common interface for CLI bus implementations.

type CliBusImpl

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

CliBusImpl implements the CliBus interface for CLI binaries.

func BuildCliBus

func BuildCliBus(rctx context.Context, le *logrus.Entry, projectID, stateRoot string) (*CliBusImpl, error)

BuildCliBus opens the shared project state for a native CLI daemon. The caller must hold the state-root lease until Release finishes.

func (*CliBusImpl) AddRelease added in v0.57.0

func (c *CliBusImpl) AddRelease(release func())

AddRelease registers cleanup to run after the bus-owned resources. Callers register cleanup before Release begins.

func (*CliBusImpl) GetBus

func (c *CliBusImpl) GetBus() bus.Bus

GetBus returns the controller bus.

func (*CliBusImpl) GetContext

func (c *CliBusImpl) GetContext() context.Context

GetContext returns the bus context.

func (*CliBusImpl) GetLogger

func (c *CliBusImpl) GetLogger() *logrus.Entry

GetLogger returns the root logger.

func (*CliBusImpl) GetPluginHostObjectKey

func (c *CliBusImpl) GetPluginHostObjectKey() string

GetPluginHostObjectKey returns the plugin host object key.

func (*CliBusImpl) GetStaticResolver

func (c *CliBusImpl) GetStaticResolver() *static.Resolver

GetStaticResolver returns the static controller resolver.

func (*CliBusImpl) GetVolume

func (c *CliBusImpl) GetVolume() volume.Volume

GetVolume returns the volume used for state.

func (*CliBusImpl) GetWorldEngine

func (c *CliBusImpl) GetWorldEngine() world.Engine

GetWorldEngine returns the world engine instance.

func (*CliBusImpl) GetWorldEngineID

func (c *CliBusImpl) GetWorldEngineID() string

GetWorldEngineID returns the world engine ID.

func (*CliBusImpl) GetWorldState

func (c *CliBusImpl) GetWorldState() world.WorldState

GetWorldState returns the world state instance.

func (*CliBusImpl) Release

func (c *CliBusImpl) Release()

Release cancels and joins the bus before running caller cleanup.

Jump to

Keyboard shortcuts

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