cobrautil

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddConfigFileForEachCommand added in v1.1.0

func AddConfigFileForEachCommand(cmd *cobra.Command, g templates.FlagGroups, configFileFlagName string)

func BindAll

func BindAll(cmd *cobra.Command, envPrefix, configFileFlagName string) error

BindAll updates the given command flags with values from the environment variables and config file. The supported formats are: JSON, YAML, TOML, HCL, and Java properties. The file format is determined by the file extension, if not specified the default format is YAML. The following precedence order of configuration sources is used: command flags, environment variables, config file, default values.

func BindFromViper added in v1.1.0

func BindFromViper(cmd *cobra.Command, v *viper.Viper) error

BindFromViper updates the given command flags with values from preconditioned Viper instance.

func DescribeFlags added in v1.1.0

func DescribeFlags(fs *pflag.FlagSet, format DescribeFormat) ([]byte, error)

func FullCommandName added in v1.1.0

func FullCommandName(cmd *cobra.Command) string

FullCommandName returns the full name of the command from the root command.

func FullCommandNameTitle added in v1.1.0

func FullCommandNameTitle(cmd *cobra.Command) string

FullCommandNameTitle returns the full name of the command from the root command with the first letter of each word capitalized.

func WriteConfigFile added in v1.1.0

func WriteConfigFile(w io.Writer, g templates.FlagGroups, configFileFlagName string, fs *pflag.FlagSet)

func WriteMarkdownDoc added in v1.1.0

func WriteMarkdownDoc(w io.Writer, g templates.FlagGroups, envPrefix string, cmd *cobra.Command)

Types

type DescribeFormat added in v1.1.0

type DescribeFormat int
const (
	Plain DescribeFormat = iota
	JSON
	YAML
)

type FlagsDescriber added in v1.1.0

type FlagsDescriber struct {
	Format         DescribeFormat
	Unredacted     bool
	ShowNotChanged bool
	ShowHidden     bool
}

func (FlagsDescriber) DescribeFlags added in v1.1.0

func (d FlagsDescriber) DescribeFlags(fs *pflag.FlagSet) ([]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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