ui

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	IsTerminalOutput bool
	IsTerminalInput  bool
)
View Source
var NotDirectoryCheck = func(input string) error {
	stat, err := os.Stat(input)
	if os.IsNotExist(err) {
		return nil
	} else {
		if !stat.IsDir() {
			return fmt.Errorf("%s is not a directory", input)
		}
	}
	return nil
}
View Source
var NotEmptyCheck = func(input string) error {
	if strings.TrimSpace(input) == "" {
		return fmt.Errorf("no value entered")
	}

	return nil
}

Functions

func Fatal

func Fatal(v ...interface{})

* Prints the message and exits with an error

func Fatalf

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

* Prints the message and exits with an error

func GetOutput

func GetOutput() io.Writer

func IsVerbose

func IsVerbose() bool

func MarkFlagsDirname

func MarkFlagsDirname(command *cobra.Command, dirnameFlags ...string)

func MarkFlagsFilename

func MarkFlagsFilename(command *cobra.Command, filenameFlags ...string)

func MarkFlagsRequired

func MarkFlagsRequired(command *cobra.Command, requiredFlags ...string)

func Printf

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

func Println

func Println(a ...interface{})

func PromptForBoolean

func PromptForBoolean(prompt string, defaultValue *bool) bool

func PromptForString

func PromptForString(prompt string, defaultValue string, matchers ...func(string) error) string

func SetOutput

func SetOutput(writer io.Writer)

func SetVerbose

func SetVerbose(value bool)

func VPrintf

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

* Prints the message only if verbose is enabled

func VPrintln

func VPrintln(a ...interface{})

* Prints the message only if verbose is enabled

Types

type UiSpinner

type UiSpinner interface {
	Stop()
}

func StartProgressf

func StartProgressf(format string, a ...interface{}) UiSpinner

Jump to

Keyboard shortcuts

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