Documentation
¶
Overview ¶
Package cli holds the command plumbing shared by every patchy binary: the conventional cobra root command and the signal-aware execution wrapper.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Execute ¶
Execute runs root under a context cancelled by SIGINT/SIGTERM and returns the process exit code; main is the only place allowed to call os.Exit.
func NewControllerRoot ¶
NewControllerRoot builds a controller's root command with the shared options bound and flag/env resolution wired into PersistentPreRunE.
Types ¶
type Options ¶
type Options struct {
// Log is the process logger; main constructs it, telemetry may replace
// it with a fanout after Init.
Log *slog.Logger
// LogLevel is set from --log-level before any command runs.
LogLevel *slog.LevelVar
// ListenAddr is the webhook/health HTTP listen address.
ListenAddr string
// LogLevelName is the configured level: debug, info, warn, or error.
LogLevelName string
// contains filtered or unexported fields
}
Options carries the configuration shared by every controller binary. Precedence: explicit flag > PATCHY_* environment > default.
func NewOptions ¶
func NewOptions() *Options
NewOptions builds Options with the conventional stderr logger and shared verbosity level every binary starts from.
func (*Options) Bind ¶
Bind registers the shared persistent flags on cmd and wires the viper environment binding. Call once from each binary's root command setup; controller-specific flags bind on top with BindExtra.