Documentation ¶
Index ¶
- Variables
- func AddBoolFlags(cmd *cobra.Command, flags []BoolFlag)
- func AddIntFlags(cmd *cobra.Command, flags []IntFlag)
- func AddOptionFlags[T any](cmd *cobra.Command, flags []OptionFlag[T])
- func AddPersistentBoolFlags(cmd *cobra.Command, flags []BoolFlag)
- func AddPersistentStringFlags(cmd *cobra.Command, flags []StringFlag)
- func AddStringFlags(cmd *cobra.Command, flags []StringFlag)
- func CombineFuncs(funcs ...cobra.PositionalArgs) cobra.PositionalArgs
- func GetBoolFromPromptOrFlag(cmd *cobra.Command, flag BoolFlag) (bool, error)
- func GetIntFromPromptOrFlag(cmd *cobra.Command, flag IntFlag) (int64, error)
- func GetStringFromPromptOrFlag(cmd *cobra.Command, flag StringFlag) (string, error)
- func IsInteractive(cmd *cobra.Command) bool
- func PromptCmd(options []*cobra.Command) (*cobra.Command, error)
- func SetupInteractiveMode(cmd *cobra.Command, _ []string) error
- func ValidateInt(input string) error
- func ValidateIntGreaterZero(input string) error
- func ValidateIntOrEmpty(input string) error
- func ValidateKyveAddress(input string) error
- func ValidateNotEmpty(input string) error
- func ValidatePathExists(input string) error
- func ValidatePathExistsOrEmpty(input string) error
- func ValidatePort(input string) error
- type BoolFlag
- type IntFlag
- type Option
- type OptionFlag
- type StringFlag
Constants ¶
This section is empty.
Variables ¶
var FlagNonInteractive = BoolFlag{Name: "yes", Short: "y", DefaultValue: false, Usage: "Non-interactive mode: Skips all prompts (default false)", Required: false}
var NoBellStdout = &noBellStdout{}
Functions ¶
func AddBoolFlags ¶
AddBoolFlags adds the given bool flags to the given command. If a flag is required it will be marked as required.
func AddIntFlags ¶
AddIntFlags adds the given int flags to the given command. If a flag is required it will be marked as required.
func AddOptionFlags ¶
func AddOptionFlags[T any](cmd *cobra.Command, flags []OptionFlag[T])
AddOptionFlags adds the given option flags to the given command. If a flag is required it will be marked as required.
func AddPersistentBoolFlags ¶
func AddPersistentStringFlags ¶
func AddPersistentStringFlags(cmd *cobra.Command, flags []StringFlag)
func AddStringFlags ¶
func AddStringFlags(cmd *cobra.Command, flags []StringFlag)
AddStringFlags adds the given string flags to the given command. If a flag is required it will be marked as required.
func CombineFuncs ¶
func CombineFuncs(funcs ...cobra.PositionalArgs) cobra.PositionalArgs
func GetBoolFromPromptOrFlag ¶
GetBoolFromPromptOrFlag returns the bool value from 1. the given flag 2. prompts the user for the value if the flag was not set
func GetIntFromPromptOrFlag ¶
GetIntFromPromptOrFlag returns the int value from 1. the given flag 2. prompts the user for the value if the flag was not set
func GetStringFromPromptOrFlag ¶
func GetStringFromPromptOrFlag(cmd *cobra.Command, flag StringFlag) (string, error)
GetStringFromPromptOrFlag returns the string value from 1. the given flag 2. prompts the user for the value if the flag was not set
func IsInteractive ¶
IsInteractive returns true if the non-interactive flag was not set.
func SetupInteractiveMode ¶
SetupInteractiveMode sets up the interactive mode for the given command. This means that all flags are not required anymore. Load the config file before running this function.
func ValidateInt ¶
func ValidateIntGreaterZero ¶
func ValidateIntOrEmpty ¶
func ValidateKyveAddress ¶
func ValidateNotEmpty ¶
func ValidatePathExists ¶
func ValidatePort ¶
Types ¶
type Option ¶
func GetOptionFromPrompt ¶
func GetOptionFromPrompt[T any](flag OptionFlag[T]) (Option[T], error)
GetOptionFromPrompt returns the option value from a select prompt
func GetOptionFromPromptOrFlag ¶
GetOptionFromPromptOrFlag returns the option value from 1. the given flag 2. prompts the user for the value if the flag was not set