Documentation
¶
Overview ¶
Package flags manages command-line flag binding and configuration for godyl.
It provides utilities for binding cobra flags to viper configuration and defines standardized flag sets for different command types. This package handles environment variable integration, flag parsing, and configuration unmarshalling to ensure consistent behavior across all commands.
Index ¶
- func Bind(cmd *cobra.Command, cfg Viperable, prefix ...string) error
- func ChainPreRun(cmd *cobra.Command, s Viperable, prefix ...string) error
- func PrefixToYAML(prefix, root string) string
- func Root(cmd *cobra.Command)
- func Status(cmd *cobra.Command)
- func Tool(cmd *cobra.Command)
- func Trim(file file.File, prefix string) (io.Reader, error)
- func Update(cmd *cobra.Command)
- type Viperable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bind ¶
Bind connects cobra flags to viper and unmarshals the configuration into the provided struct. It sets up environment variable handling with the given prefix and handles flag binding. Omit the prefix to use the command hierarchy as the prefix.
func ChainPreRun ¶ added in v0.0.4
ChainPreRun is a helper function to chain the PreRunE functions of a command and its parent.
func PrefixToYAML ¶ added in v0.0.11
func Root ¶
Root adds the root-level command flags to the provided cobra command. These flags apply to the root command.
func Status ¶ added in v0.0.11
Status adds status-related command flags to the provided cobra command.
func Tool ¶
Tool adds tool-related command flags to the provided cobra command. These flags control how tools are downloaded and installed.