internaldebug

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FlagAnnotation = "leodido/structcli/debug-flag"
)

Variables

This section is empty.

Functions

func GetFormat added in v0.16.0

func GetFormat(c *cobra.Command) string

GetFormat returns the active debug format ("text" or "json") for the command, or "" if debug is not active.

func IsDebugActive

func IsDebugActive(c *cobra.Command) bool

IsDebugActive checks if the debug option is set for the command c, either through a command-line flag or an environment variable.

Types

type FlagSource added in v0.16.0

type FlagSource string

FlagSource identifies where a flag's resolved value came from.

const (
	SourceFlag    FlagSource = "flag"
	SourceEnv     FlagSource = "env"
	SourceConfig  FlagSource = "config"
	SourceDefault FlagSource = "default"
)

func ResolveFlagSource added in v0.16.0

func ResolveFlagSource(f *pflag.Flag, configViper *viper.Viper) FlagSource

ResolveFlagSource determines where a flag's value came from.

Priority: flag (explicitly set on CLI) > env > config > default.

Jump to

Keyboard shortcuts

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