util

package
v0.0.0-...-194279b Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2020 License: MIT Imports: 19 Imported by: 4

Documentation

Index

Constants

View Source
const (
	NoMaxArgs = -1
)

Variables

This section is empty.

Functions

func AuthPrint

func AuthPrint(i interface{})

func AuthPrintf

func AuthPrintf(format string, a ...interface{})

func CheckArguments

func CheckArguments(cmd *cobra.Command, args []string, min int, max int)

func CheckIntegerBounds

func CheckIntegerBounds(cmd *cobra.Command, name string, val int, min int, max int)

func Error

func Error(err interface{})

func ErrorFatal

func ErrorFatal(err interface{})

func ErrorFatalf

func ErrorFatalf(base string, args ...interface{})

func Errorf

func Errorf(base string, args ...interface{})

func FlagNotProvidedError

func FlagNotProvidedError(cmd *cobra.Command, flagName string)

func GetBoolFlagValue

func GetBoolFlagValue(cmd *cobra.Command, flag string) bool

func GetFloat64FlagValue

func GetFloat64FlagValue(cmd *cobra.Command, flag string) float64

func GetInt64FlagValue

func GetInt64FlagValue(cmd *cobra.Command, flag string) int64

func GetIntFlagValue

func GetIntFlagValue(cmd *cobra.Command, flag string) int

func GetStringFlagValue

func GetStringFlagValue(cmd *cobra.Command, flag string) string

func GetStringSliceFlagValue

func GetStringSliceFlagValue(cmd *cobra.Command, flag string) []string

func InvalidArgument

func InvalidArgument(arg string)

func InvalidInteger

func InvalidInteger(name string, value string, fatal bool)

func IsTTY

func IsTTY() bool

func MalformedUsageError

func MalformedUsageError(cmd *cobra.Command, err interface{})

func MustReadFile

func MustReadFile(path string) []byte

func PlainPrint

func PlainPrint(i interface{})

func PlainPrintf

func PlainPrintf(format string, a ...interface{})

func Print

func Print(i interface{})

func PrintKV

func PrintKV(depth int, k interface{}, v interface{})

func PrintS

func PrintS(depth int, v interface{})

func Printf

func Printf(format string, a ...interface{})

func PromptBool

func PromptBool(text string) bool

func PromptInt64

func PromptInt64(text string) (int64, error)

func PromptSelection

func PromptSelection(text string, options interface{}) int

func PromptString

func PromptString(text string) string

func ReadInputFile

func ReadInputFile(basedir string, filename string) (io.ReadCloser, error)

func RequireFlags

func RequireFlags(cmd *cobra.Command, flags ...string)

func SetupBars

func SetupBars(bars []BarInfo) (*mpb.Progress, []*mpb.Bar)

Types

type BarInfo

type BarInfo struct {
	Name  string
	Total int64
}

type StatusBar

type StatusBar interface {
	Run() <-chan error
}

Jump to

Keyboard shortcuts

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