utils

package
v0.0.0-...-88e28f6 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NoBellStdout = &noBellStdout{}

Functions

func AddBoolFlags

func AddBoolFlags(cmd *cobra.Command, flags []types.BoolFlag)

AddBoolFlags adds the given bool flags to the given command. If a flag is required it will be marked as required.

func AddIntFlags

func AddIntFlags(cmd *cobra.Command, flags []types.IntFlag)

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 []types.OptionFlag[T])

AddOptionFlags adds the given option flags to the given command. If a flag is required it will be marked as required.

func AddStringFlags

func AddStringFlags(cmd *cobra.Command, flags []types.StringFlag)

AddStringFlags adds the given string flags to the given command. If a flag is required it will be marked as required.

func CheckIfHasValaccounts

func CheckIfHasValaccounts(_ *cobra.Command, _ []string) error

func CheckIfInitialized

func CheckIfInitialized(_ *cobra.Command, _ []string) error

func CombineFuncs

func CombineFuncs(funcs ...cobra.PositionalArgs) cobra.PositionalArgs

func GetAccAddressFromMnemonic

func GetAccAddressFromMnemonic(mnemonic string) (sdk.AccAddress, error)

func GetBoolFromPromptOrFlag

func GetBoolFromPromptOrFlag(cmd *cobra.Command, flag types.BoolFlag) (bool, error)

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

func GetIntFromPromptOrFlag(cmd *cobra.Command, flag types.IntFlag) (int64, error)

GetIntFromPromptOrFlag returns the int value from 1. the given flag 2. prompts the user for the value if the flag was not set

func GetOptionFromPrompt

func GetOptionFromPrompt[T any](flag types.OptionFlag[T]) (types.Option[T], error)

GetOptionFromPrompt returns the option value from a select prompt

func GetOptionFromPromptOrFlag

func GetOptionFromPromptOrFlag[T any](cmd *cobra.Command, flag types.OptionFlag[T]) (types.Option[T], error)

GetOptionFromPromptOrFlag returns the option 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 types.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

func IsInteractive(cmd *cobra.Command) bool

IsInteractive returns true if the non-interactive flag was not set.

func PrintlnItalic

func PrintlnItalic(text string)

func PromptCmd

func PromptCmd(options []types.CmdConfig) (*types.CmdConfig, error)

PromptCmd prompts the user to select one of the given options.

func SetupInteractiveMode

func SetupInteractiveMode(cmd *cobra.Command, _ []string) error

SetupInteractiveMode sets up the interactive mode for the given command. This means that all flags are not required anymore.

func ValidateInt

func ValidateInt(input string) error

func ValidateIntGreaterZero

func ValidateIntGreaterZero(input string) error

func ValidateIntOrEmpty

func ValidateIntOrEmpty(input string) error

func ValidateKyveAddress

func ValidateKyveAddress(input string) error

func ValidateNotEmpty

func ValidateNotEmpty(input string) error

func ValidatePathExists

func ValidatePathExists(input string) error

func ValidatePathExistsOrEmpty

func ValidatePathExistsOrEmpty(input string) error

func ValidatePort

func ValidatePort(input string) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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