flags

package
v1.5.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2026 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindEnv added in v1.3.1

func BindEnv(fs *pflag.FlagSet, flagName string)

BindEnv wires the canonical DEVSY_* env var into a cobra flag. Call it immediately after the flag's *Var registration. If the env var is set, the value is applied to the flag (Changed=true, satisfying MarkFlagRequired) and the usage string advertises the env var.

Failure modes are loud by design:

  • panics if the flag is not registered (programmer bug at startup);
  • log.Fatalf if the env value is rejected by the flag's type (operator bug; e.g. DEVSY_DEBUG=garbage on a bool flag). This matches the contract of the prior inheritFlagsFromEnvironment loop so misconfigured env vars are never silently ignored.

func EnvName added in v1.3.1

func EnvName(flagName string) string

EnvName returns the canonical env var name for a flag under the uniform rule:

config.EnvPrefix + uppercase(flagName) with "-" replaced by "_"

Example: "agent-url" -> "DEVSY_AGENT_URL".

Types

type GlobalFlags

type GlobalFlags struct {
	Context   string
	Provider  string
	AgentDir  string
	DevsyHome string
	UID       string
	Owner     platform.OwnerFilter

	LogOutput    string
	ResultFormat string
	Verbosity    int
	Quiet        bool
	Debug        bool
}

func SetGlobalFlags

func SetGlobalFlags(flags *flag.FlagSet) *GlobalFlags

SetGlobalFlags applies the global flags.

Jump to

Keyboard shortcuts

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