common

package
v0.0.0-...-b3d26d0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2020 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ColorFontGreen = iota
	ColorFontRed
	ColorFontYellow
)

Variables

This section is empty.

Functions

func ColorString

func ColorString(s string, color int) string

func Err

func Err(errType, msg string, args ...interface{}) *commonErr

...

func ErrorString

func ErrorString(fmtStr string, args ...interface{})

func FatalError

func FatalError(err error)

func FatalString

func FatalString(fmtStr string, args ...interface{})

func FlashTerminal

func FlashTerminal(value string)

func FlashTerminalLen

func FlashTerminalLen(length int)

func IsBytesGBK

func IsBytesGBK(data []byte) bool

func IsBytesUtf8

func IsBytesUtf8(data []byte) bool

func Log

func Log(fmtStr string, args ...interface{})

func ShowFatalError

func ShowFatalError(op string, err error)

func ShowLog

func ShowLog(on bool)

func WithDelay

func WithDelay(ctx Context, doneFunc func())

Types

type ConfParam

type ConfParam interface {
	Name() string
	Short() string
	ValueP() interface{}
	Default() interface{}
	Usage() string
	Type() string
	Require() bool
}

type Context

type Context struct {
	// contains filtered or unexported fields
}

func NewContext

func NewContext() Context

func (Context) AddConf

func (ctx Context) AddConf(conf ConfParam, cmd *cobra.Command)

func (Context) Check

func (ctx Context) Check()

func (Context) Get

func (ctx Context) Get(key string) interface{}

func (Context) GetBool

func (ctx Context) GetBool(key string) bool

func (Context) GetString

func (ctx Context) GetString(key string) string

func (Context) Set

func (ctx Context) Set(key string, val interface{})

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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