Documentation
¶
Index ¶
- func AddConfigFileForEachCommand(cmd *cobra.Command, g templates.FlagGroups, configFileFlagName string)
- func BindAll(cmd *cobra.Command, envPrefix, configFileFlagName string, opts ...ViperOpt) error
- func BindFromViper(cmd *cobra.Command, v *viper.Viper) error
- func FullCommandName(cmd *cobra.Command) string
- func FullCommandNameTitle(cmd *cobra.Command) string
- func WriteConfigFile(w io.Writer, g templates.FlagGroups, configFileFlagName string, ...)
- func WriteMarkdownDoc(w io.Writer, g templates.FlagGroups, envPrefix string, cmd *cobra.Command)
- type DescribeFormat
- type FlagsDescriber
- type ViperOpt
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 ¶
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
BindFromViper updates the given command flags with values from preconditioned Viper instance.
func FullCommandName ¶ added in v1.1.0
FullCommandName returns the full name of the command from the root command.
func FullCommandNameTitle ¶ added in v1.1.0
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 WriteMarkdownDoc ¶ added in v1.1.0
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 ShowChangedOnly bool ShowHidden bool }
func (FlagsDescriber) DescribeFlags ¶ added in v1.1.0
func (d FlagsDescriber) DescribeFlags(fs *pflag.FlagSet) ([]byte, error)