Documentation
¶
Index ¶
Constants ¶
const (
// DefaultProfilerPort is the default port for the Go pprof profiler.
DefaultProfilerPort = 6060
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Flags ¶
type Flags struct {
// Working directory and path configuration.
Chdir string
BasePath string
Config []string // Config file paths.
ConfigPath []string // Config directory paths.
// Logging configuration.
LogsLevel string
LogsFile string
NoColor bool
// Terminal and I/O configuration.
ForceColor bool // Force color output even when not a TTY (--force-color).
ForceTTY bool // Force TTY mode with sane defaults (--force-tty).
Mask bool // Enable automatic masking of sensitive data (--mask).
// Output configuration.
Pager PagerSelector
// Authentication.
Identity IdentitySelector
// Profiles.
Profile []string // Profile selects which configuration profiles to activate.
// Profiling configuration.
ProfilerEnabled bool
ProfilerPort int
ProfilerHost string
ProfileFile string
ProfileType string
// Performance visualization.
Heatmap bool
HeatmapMode string
// System configuration.
RedirectStderr string
Version bool
}
Flags contains all persistent flags available to every command. These flags are inherited from RootCmd.PersistentFlags() and should be embedded in all command interpreters using Go struct embedding.
This provides a DRY way to handle global flags - define once, use everywhere.
Example usage:
type TerraformOptions struct {
global.Flags // Embedded - provides all global flags
Stack string
DryRun bool
}
// Access global flags naturally:
interpreter.LogsLevel // From global.Flags
interpreter.NoColor // From global.Flags
interpreter.Stack // From TerraformOptions
func NewFlags ¶
func NewFlags() Flags
NewFlags creates a Flags with default values. This is primarily used for testing.
func (*Flags) GetGlobalFlags ¶
GetGlobalFlags returns a pointer to the Flags. This implements part of the CommandOptions interface.
type IdentitySelector ¶
type IdentitySelector struct {
// contains filtered or unexported fields
}
IdentitySelector represents the state of the identity flag. The identity flag has three states: 1. Not provided (use default from config/env) 2. Provided without value (--identity) → interactive selection 3. Provided with value (--identity=name) → use specific identity
This type encapsulates the complex NoOptDefVal semantics of the identity flag.
func NewIdentitySelector ¶
func NewIdentitySelector(value string, provided bool) IdentitySelector
NewIdentitySelector creates an IdentitySelector from flag state.
func (IdentitySelector) IsEmpty ¶
func (i IdentitySelector) IsEmpty() bool
IsEmpty returns true if no identity was provided.
func (IdentitySelector) IsInteractiveSelector ¶
func (i IdentitySelector) IsInteractiveSelector() bool
IsInteractiveSelector returns true if --identity was used without a value. This triggers interactive identity selection.
func (IdentitySelector) IsProvided ¶
func (i IdentitySelector) IsProvided() bool
IsProvided returns true if the flag was explicitly set.
func (IdentitySelector) Value ¶
func (i IdentitySelector) Value() string
Value returns the identity name. Returns empty string if not provided or if interactive selection.
type PagerSelector ¶
type PagerSelector struct {
// contains filtered or unexported fields
}
PagerSelector handles the pager flag which has three states: 1. Not set (use config/env default) 2. Set without value (--pager) → enable with default pager 3. Set with value (--pager=less or --pager=false) → use specific pager or disable
This type encapsulates the NoOptDefVal semantics of the pager flag.
func NewPagerSelector ¶
func NewPagerSelector(value string, provided bool) PagerSelector
NewPagerSelector creates a PagerSelector from flag state.
func (PagerSelector) IsEnabled ¶
func (p PagerSelector) IsEnabled() bool
IsEnabled returns true if pager should be enabled. Returns false if explicitly set to "false" or not provided.
func (PagerSelector) IsProvided ¶
func (p PagerSelector) IsProvided() bool
IsProvided returns true if the flag was explicitly set.
func (PagerSelector) Pager ¶
func (p PagerSelector) Pager() string
Pager returns the pager command to use. Returns empty string if using default pager or if disabled.
func (PagerSelector) Value ¶
func (p PagerSelector) Value() string
Value returns the raw flag value.