Documentation
¶
Index ¶
- Constants
- Variables
- func GetCurrentEnv() string
- func ShouldDisableColors() bool
- func WrapColorAwareRunE(fn func(cmd *cobra.Command, args []string, noColor bool) error) func(cmd *cobra.Command, args []string) error
- func WrapOutputFormatRunE(fn func(cmd *cobra.Command, args []string, noColor bool, format string) error) func(cmd *cobra.Command, args []string) error
- func WrapRunE(runE func(cmd *cobra.Command, args []string) error) func(cmd *cobra.Command, args []string) error
Constants ¶
View Source
const ( FormatTable = "table" FormatJSON = "json" FormatCSV = "csv" FormatXML = "xml" )
Variables ¶
View Source
var ( Env string OutputFormat string NoColor bool ValidFormats = []string{FormatTable, FormatJSON, FormatCSV, FormatXML} )
View Source
var ConfirmPrompt = func(question string, noColor bool) bool { var response string if !noColor { fmt.Print(color.YellowString("%s [y/N]: ", question)) } else { fmt.Printf("%s [y/N]: ", question) } _, err := fmt.Scanln(&response) if err != nil { fmt.Println("Error reading input:", err) return false } response = strings.ToLower(strings.TrimSpace(response)) return response == "y" || response == "yes" }
Functions ¶
func GetCurrentEnv ¶
func GetCurrentEnv() string
func ShouldDisableColors ¶ added in v0.3.2
func ShouldDisableColors() bool
func WrapColorAwareRunE ¶
func WrapColorAwareRunE(fn func(cmd *cobra.Command, args []string, noColor bool) error) func(cmd *cobra.Command, args []string) error
WrapColorAwareRunE combines WrapRunE and WrapCommandFunc to handle both error formatting and passing the noColor flag to command functions.
func WrapOutputFormatRunE ¶
func WrapOutputFormatRunE(fn func(cmd *cobra.Command, args []string, noColor bool, format string) error) func(cmd *cobra.Command, args []string) error
WrapOutputFormatRunE handles both output format and color settings in command functions. This wrapper takes a function that needs both output format and noColor parameters.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.