cli

package
v1.0.19 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 39 Imported by: 0 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

View Source
const (
	ExitOK     = 0
	ExitError  = 1 // runtime / operational failure
	ExitMisuse = 2 // invalid usage, unknown flags/commands, bad arguments
)

Standard process exit codes (sysexits-aligned for CLI misuse).

Variables

View Source
var ErrAgentNotFound = errors.New("agent not found")

ErrAgentNotFound reports that no agent matched the requested name.

Functions

func Execute

func Execute() error

Execute runs the CLI

func ExitCode

func ExitCode(err error) int

ExitCode maps an Execute error to a process exit status.

func FormatUserError

func FormatUserError(err error) string

FormatUserError is the stderr text for a failed command. Blocked provider APIs (CreateAgent, peering, cluster register, and similar) all print the same backend copy.

func GetAPIURL

func GetAPIURL(cmd *cobra.Command, cfgBaseURL string) string

GetAPIURL returns the API URL with the following priority: 1. --api-url flag (if set) 2. Config-derived base URL (e.g. mothership.host profile for a LAN control plane) 3. Dev API URL (if --dev flag is set; localhost when no control-plane host is configured) 4. Config file API base URL

func GetDevAPIURL

func GetDevAPIURL(cmd *cobra.Command) string

GetDevAPIURL returns the development API URL if --dev is enabled, otherwise returns empty string

func GetDevFrontendURL

func GetDevFrontendURL(cmd *cobra.Command) string

GetDevFrontendURL returns the development frontend URL if --dev is enabled, otherwise returns empty string

func GetDevSettings

func GetDevSettings(cmd *cobra.Command) (debug, verbose, tlsInsecure bool)

GetDevSettings returns development settings based on --dev flag If --dev is set, it enables debug, verbose, and TLS insecure mode

func IsDevMode

func IsDevMode(cmd *cobra.Command) bool

IsDevMode checks if development mode is enabled via the root --dev flag.

func NewUsageError

func NewUsageError(err error) error

NewUsageError wraps err as invalid CLI usage.

func RequiredFlag

func RequiredFlag(name string) error

RequiredFlag reports a missing mandatory flag as invalid usage (exit 2).

func RequiredFlagf

func RequiredFlagf(name, hintFormat string, args ...any) error

RequiredFlagf reports a missing mandatory flag together with a hint on how to supply it.

func RequiredOneOfFlags

func RequiredOneOfFlags(names ...string) error

RequiredOneOfFlags reports that at least one of several alternative flags must be set.

func UsageErrorf

func UsageErrorf(format string, args ...any) error

UsageErrorf formats a usage error.

Types

type UsageError

type UsageError struct {
	Err error
}

UsageError marks invalid CLI invocation (flags, args, unknown commands).

func (*UsageError) Error

func (e *UsageError) Error() string

func (*UsageError) Unwrap

func (e *UsageError) Unwrap() error

Jump to

Keyboard shortcuts

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