builtin

package
v0.0.0-...-0bc6d30 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2025 License: MIT Imports: 21 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

This section is empty.

Functions

func CustomizeHelpTemplate

func CustomizeHelpTemplate(cmd *cobra.Command, branding string)

CustomizeHelpTemplate customizes the help template for a command.

func CustomizeUsageTemplate

func CustomizeUsageTemplate(cmd *cobra.Command)

CustomizeUsageTemplate customizes the usage template for a command.

func DefaultAPIChangelogFunc

func DefaultAPIChangelogFunc(config *cli.Config) func() ([]openapi.ChangelogEntry, error)

DefaultAPIChangelogFunc returns a default API changelog.

func DefaultAPIDeprecationsFunc

func DefaultAPIDeprecationsFunc() func() ([]openapi.Deprecation, error)

DefaultAPIDeprecationsFunc returns default API deprecations.

func DefaultBinaryChangelogFunc

func DefaultBinaryChangelogFunc(config *cli.Config) func() ([]ChangelogEntry, error)

DefaultBinaryChangelogFunc returns a default binary changelog.

func DefaultBinaryDeprecationsFunc

func DefaultBinaryDeprecationsFunc() func() ([]BinaryDeprecation, error)

DefaultBinaryDeprecationsFunc returns default binary deprecations.

func DefaultCheckUpdateFunc

func DefaultCheckUpdateFunc(config *cli.Config, currentVersion string) func(ctx context.Context) (*UpdateInfo, error)

DefaultCheckUpdateFunc is a default implementation for checking updates.

func DefaultPerformUpdateFunc

func DefaultPerformUpdateFunc() func(ctx context.Context, version string) error

DefaultPerformUpdateFunc is a default implementation for performing updates.

func GetVersionShort

func GetVersionShort(config *cli.Config) string

GetVersionShort returns a short version string suitable for --version flag.

func ListConfigKeys

func ListConfigKeys(config *cli.UserConfig) []string

ListConfigKeys returns all available config keys.

func NewAuthCommand

func NewAuthCommand(opts *AuthOptions) *cobra.Command

NewAuthCommand creates a new auth command group.

func NewCacheCommand

func NewCacheCommand(opts *CacheOptions) *cobra.Command

NewCacheCommand creates a new cache command group.

func NewChangelogCommand

func NewChangelogCommand(opts *ChangelogOptions) *cobra.Command

NewChangelogCommand creates a new changelog command.

func NewCompletionCommand

func NewCompletionCommand(opts *CompletionOptions, rootCmd *cobra.Command) *cobra.Command

NewCompletionCommand creates a new completion command.

func NewConfigCommand

func NewConfigCommand(opts *ConfigOptions) *cobra.Command

NewConfigCommand creates a new config command group.

func NewContextCommand

func NewContextCommand(opts *ContextOptions) *cobra.Command

NewContextCommand creates a new context command group.

func NewDeprecationsCommand

func NewDeprecationsCommand(opts *DeprecationsOptions) *cobra.Command

NewDeprecationsCommand creates a new deprecations command.

func NewHelpCommand

func NewHelpCommand(opts *HelpOptions, rootCmd *cobra.Command) *cobra.Command

NewHelpCommand creates a new help command. Note: Cobra provides built-in help functionality, but this allows customization.

func NewHistoryCommand

func NewHistoryCommand(opts *HistoryOptions) *cobra.Command

NewHistoryCommand creates a new history command.

func NewInfoCommand

func NewInfoCommand(opts *InfoOptions) *cobra.Command

NewInfoCommand creates a new info command.

func NewUpdateCommand

func NewUpdateCommand(opts *UpdateOptions) *cobra.Command

NewUpdateCommand creates a new update command.

func NewVersionCommand

func NewVersionCommand(opts *VersionOptions) *cobra.Command

NewVersionCommand creates a new version command.

func SetupCompletionFunctions

func SetupCompletionFunctions(cmd *cobra.Command)

SetupCompletionFunctions configures dynamic completion for a command.

Types

type APIDetails

type APIDetails struct {
	Title     string `json:"title,omitempty"`
	Version   string `json:"version,omitempty"`
	BaseURL   string `json:"base_url"`
	SpecURL   string `json:"spec_url"`
	Endpoints int    `json:"endpoints,omitempty"`
}

APIDetails contains API information.

type AuthOptions

type AuthOptions struct {
	AuthManager *auth.Manager
	Output      io.Writer
}

AuthOptions configures the auth command behavior.

type BinaryDeprecation

type BinaryDeprecation struct {
	Feature     string    `json:"feature"`
	Replacement string    `json:"replacement,omitempty"`
	Sunset      time.Time `json:"sunset,omitempty"`
	Message     string    `json:"message"`
	DocsURL     string    `json:"docs_url,omitempty"`
	Severity    string    `json:"severity"` // warning, critical
}

BinaryDeprecation represents a deprecated CLI feature.

type CLIDetails

type CLIDetails struct {
	Name        string `json:"name"`
	Version     string `json:"version"`
	Description string `json:"description"`
	Homepage    string `json:"homepage,omitempty"`
	DocsURL     string `json:"docs_url,omitempty"`
}

CLIDetails contains CLI metadata.

type CLIInfo

type CLIInfo struct {
	CLI    CLIDetails    `json:"cli"`
	API    APIDetails    `json:"api"`
	Config ConfigDetails `json:"config"`
	Status StatusDetails `json:"status,omitempty"`
}

CLIInfo contains information about the CLI and API.

type CacheInfo

type CacheInfo struct {
	CacheDir    string    `json:"cache_dir"`
	Size        int64     `json:"size_bytes"`
	SpecCached  bool      `json:"spec_cached"`
	SpecAge     string    `json:"spec_age,omitempty"`
	SpecURL     string    `json:"spec_url,omitempty"`
	LastFetched time.Time `json:"last_fetched,omitempty"`
}

CacheInfo contains information about the cache.

type CacheOptions

type CacheOptions struct {
	CLIName string
	Output  io.Writer
}

CacheOptions configures the cache command behavior.

type ChangelogEntry

type ChangelogEntry struct {
	Version    string    `json:"version"`
	Date       time.Time `json:"date"`
	Changes    []string  `json:"changes"`
	Breaking   []string  `json:"breaking,omitempty"`
	Deprecated []string  `json:"deprecated,omitempty"`
	IsCurrent  bool      `json:"is_current,omitempty"`
}

ChangelogEntry represents a single changelog entry.

type ChangelogOptions

type ChangelogOptions struct {
	Config              *cli.Config
	ShowBinaryChanges   bool
	ShowAPIChanges      bool
	BinaryChangelogFunc func() ([]ChangelogEntry, error)
	APIChangelogFunc    func() ([]openapi.ChangelogEntry, error)
	Output              io.Writer
}

ChangelogOptions configures the changelog command behavior.

type CompletionFunc

type CompletionFunc func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective)

CompletionFunc is a helper type for dynamic completion functions.

func FixedCompletion

func FixedCompletion(values ...string) CompletionFunc

FixedCompletion returns a completion function with fixed values.

func NoFileCompletion

func NoFileCompletion() CompletionFunc

NoFileCompletion returns a completion function that disables file completion.

type CompletionOptions

type CompletionOptions struct {
	CLIName       string
	EnabledShells []string
	Output        io.Writer
}

CompletionOptions configures the completion command behavior.

type ConfigDetails

type ConfigDetails struct {
	ConfigFile string `json:"config_file"`
	CacheDir   string `json:"cache_dir"`
	DataDir    string `json:"data_dir"`
	StateDir   string `json:"state_dir"`
	Auth       string `json:"auth"`
}

ConfigDetails contains configuration paths.

type ConfigOptions

type ConfigOptions struct {
	CLIName    string
	AllowEdit  bool
	Output     io.Writer
	UserConfig *cli.UserConfig
	SaveFunc   func(*cli.UserConfig) error
}

ConfigOptions configures the config command behavior.

type ContextOptions

type ContextOptions struct {
	ContextManager *state.ContextManager
	Output         io.Writer
}

ContextOptions configures the context command behavior.

type DeprecationsOptions

type DeprecationsOptions struct {
	Config                 *cli.Config
	ShowBinaryDeprecations bool
	ShowAPIDeprecations    bool
	AllowScan              bool
	BinaryDeprecationsFunc func() ([]BinaryDeprecation, error)
	APIDeprecationsFunc    func() ([]openapi.Deprecation, error)
	Output                 io.Writer
}

DeprecationsOptions configures the deprecations command behavior.

type FlagManager

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

FlagManager manages global flags for a CLI.

func NewFlagManager

func NewFlagManager(config *cli.Config) *FlagManager

NewFlagManager creates a new flag manager.

func (*FlagManager) AddGlobalFlags

func (fm *FlagManager) AddGlobalFlags(cmd *cobra.Command)

AddGlobalFlags adds global flags to a command.

func (*FlagManager) ApplyToConfig

func (fm *FlagManager) ApplyToConfig(config *cli.Config)

ApplyToConfig applies global flags to the loaded configuration.

func (*FlagManager) GetFlags

func (fm *FlagManager) GetFlags() *GlobalFlags

GetFlags returns the global flags.

func (*FlagManager) GetOutputFormat

func (fm *FlagManager) GetOutputFormat() string

GetOutputFormat returns the output format.

func (*FlagManager) GetVerbosityLevel

func (fm *FlagManager) GetVerbosityLevel() int

GetVerbosityLevel returns the verbosity level (0, 1, 2, 3, ...).

func (*FlagManager) IsDebug

func (fm *FlagManager) IsDebug() bool

IsDebug returns true if debug mode is enabled.

func (*FlagManager) IsQuiet

func (fm *FlagManager) IsQuiet() bool

IsQuiet returns true if quiet mode is enabled.

func (*FlagManager) IsVerbose

func (fm *FlagManager) IsVerbose() bool

IsVerbose returns true if verbose mode is enabled.

func (*FlagManager) ShouldSkipConfirmation

func (fm *FlagManager) ShouldSkipConfirmation() bool

ShouldSkipConfirmation returns true if confirmations should be skipped.

func (*FlagManager) Validate

func (fm *FlagManager) Validate() error

Validate validates the global flags.

type GlobalFlags

type GlobalFlags struct {
	// Config and profile
	Config  string
	Profile string

	// Output formatting
	Output  string
	Verbose int
	Quiet   bool
	Debug   bool
	NoColor bool

	// HTTP client settings
	Timeout time.Duration
	Retry   int
	NoCache bool

	// Automation
	Yes bool

	// Update behavior
	NoUpdateCheck bool
}

GlobalFlags represents all global flags that can be used across commands.

type HelpOptions

type HelpOptions struct {
	ShowExamples bool
	ShowAliases  bool
	Output       io.Writer
}

HelpOptions configures the help command behavior.

type HistoryOptions

type HistoryOptions struct {
	History *state.History
	Output  io.Writer
}

HistoryOptions configures the history command behavior.

type InfoOptions

type InfoOptions struct {
	Config          *cli.Config
	CheckAPIHealth  bool
	ShowConfigPaths bool
	OutputFormat    string
	Output          io.Writer
	HTTPClient      *http.Client
}

InfoOptions configures the info command behavior.

type StatusDetails

type StatusDetails struct {
	APIReachable bool      `json:"api_reachable"`
	AuthValid    bool      `json:"auth_valid,omitempty"`
	SpecCached   bool      `json:"spec_cached"`
	SpecAge      string    `json:"spec_age,omitempty"`
	LastChecked  time.Time `json:"last_checked"`
}

StatusDetails contains API health status.

type UpdateInfo

type UpdateInfo struct {
	CurrentVersion  string   `json:"current_version"`
	LatestVersion   string   `json:"latest_version"`
	UpdateAvailable bool     `json:"update_available"`
	DownloadURL     string   `json:"download_url,omitempty"`
	Changelog       []string `json:"changelog,omitempty"`
	ReleaseNotes    string   `json:"release_notes,omitempty"`
}

UpdateInfo contains information about available updates.

type UpdateOptions

type UpdateOptions struct {
	Config            *cli.Config
	CurrentVersion    string
	RequireConfirm    bool
	ShowChangelog     bool
	Output            io.Writer
	CheckUpdateFunc   func(ctx context.Context) (*UpdateInfo, error)
	PerformUpdateFunc func(ctx context.Context, version string) error
}

UpdateOptions configures the update command behavior.

type VersionInfo

type VersionInfo struct {
	ClientVersion string    `json:"client_version"`
	ServerVersion string    `json:"server_version,omitempty"`
	APITitle      string    `json:"api_title,omitempty"`
	OpenAPISpec   string    `json:"openapi_spec,omitempty"`
	Built         time.Time `json:"built,omitempty"`
	GoVersion     string    `json:"go_version"`
	Platform      string    `json:"platform"`
	Compiler      string    `json:"compiler"`
}

VersionInfo contains version information about the CLI and API.

type VersionOptions

type VersionOptions struct {
	Config         *cli.Config
	BuildTime      time.Time
	ShowAPIVersion bool
	OutputFormat   string
	Output         io.Writer
}

VersionOptions configures the version command behavior.

Jump to

Keyboard shortcuts

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