flag

package
v2.5.3 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckRequiredFlags

func CheckRequiredFlags(flags []interface{}) error

CheckRequiredFlags Checks if flags in the list are all set in Viper

func MakeFlagBindings

func MakeFlagBindings(cmd *cobra.Command, flags []Flag, persistent bool)

MakeFlagBindings Bind flags to the command setting them by hard flags from the CLI, .env values, and environment variable values. Make the flags persistent for the command that needs to propagate them to subcommands; for instance the global flags on the root command.

https://github.com/spf13/cobra/blob/main/site/content/user_guide.md#working-with-flags

Types

type Flag

type Flag struct {
	Name   string
	Short  string
	Value  interface{}
	Usage  string
	EnvVar string
}

Flag Convenience struct for Viper flag parameters

Jump to

Keyboard shortcuts

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