Documentation
¶
Index ¶
- func Add(cmd *cobra.Command, defs ...Flag)
- func AddPersistent(cmd *cobra.Command, defs ...Flag)
- func BindEnv(fs *pflag.FlagSet, flagName string)
- func EnvName(flagName string) string
- func RegisterDevContainerModifierFlags(fs *flag.FlagSet, opts DevContainerModifierFlags)
- type BoolFlag
- type DevContainerModifierFlags
- type DurationFlag
- type Flag
- type Int64Flag
- type IntFlag
- type StringArrayFlag
- type StringFlag
- type StringSliceFlag
- type ValueFlag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddPersistent ¶
AddPersistent registers the given flag definitions on the command's persistent flags (inherited by subcommands).
func BindEnv ¶
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 ¶
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".
func RegisterDevContainerModifierFlags ¶
func RegisterDevContainerModifierFlags(fs *flag.FlagSet, opts DevContainerModifierFlags)
Types ¶
type BoolFlag ¶
type BoolFlag struct {
// contains filtered or unexported fields
}
BoolFlag defines a bool flag.
type DurationFlag ¶
type DurationFlag struct {
// contains filtered or unexported fields
}
DurationFlag defines a time.Duration flag.
func (*DurationFlag) Hidden ¶
func (f *DurationFlag) Hidden() *DurationFlag
Hidden marks the flag hidden from help output.
type Int64Flag ¶
type Int64Flag struct {
// contains filtered or unexported fields
}
Int64Flag defines an int64 flag.
type IntFlag ¶
type IntFlag struct {
// contains filtered or unexported fields
}
IntFlag defines an int flag.
type StringArrayFlag ¶
type StringArrayFlag struct {
// contains filtered or unexported fields
}
StringArrayFlag defines a repeatable string array flag.
func StringArray ¶
func StringArray(dest *[]string, name string, def []string, usage string) *StringArrayFlag
StringArray binds a repeatable string array flag.
func (*StringArrayFlag) Hidden ¶
func (f *StringArrayFlag) Hidden() *StringArrayFlag
Hidden marks the flag hidden from help output.
func (*StringArrayFlag) Shorthand ¶
func (f *StringArrayFlag) Shorthand(s string) *StringArrayFlag
Shorthand sets a single-letter shorthand.
type StringFlag ¶
type StringFlag struct {
// contains filtered or unexported fields
}
StringFlag defines a string flag.
func String ¶
func String(dest *string, name, def, usage string) *StringFlag
String binds a string flag to dest.
func (*StringFlag) Hidden ¶
func (f *StringFlag) Hidden() *StringFlag
Hidden marks the flag hidden from help output.
func (*StringFlag) Shorthand ¶
func (f *StringFlag) Shorthand(s string) *StringFlag
Shorthand sets a single-letter shorthand (e.g. "L" for -L).
type StringSliceFlag ¶
type StringSliceFlag struct {
// contains filtered or unexported fields
}
StringSliceFlag defines a comma-separated / repeatable string slice flag.
func StringSlice ¶
func StringSlice(dest *[]string, name string, def []string, usage string) *StringSliceFlag
StringSlice binds a comma-separated string slice flag to dest.
func (*StringSliceFlag) Hidden ¶
func (f *StringSliceFlag) Hidden() *StringSliceFlag
Hidden marks the flag hidden from help output.
func (*StringSliceFlag) Shorthand ¶
func (f *StringSliceFlag) Shorthand(s string) *StringSliceFlag
Shorthand sets a single-letter shorthand.