cli

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Debug bool
)

Functions

func ArgsNumCheck added in v0.1.5

func ArgsNumCheck(cmd *cobra.Command, args []string, invalidNum int)

func Debugf added in v0.1.5

func Debugf(format string, a ...interface{}) (n int, err error)

func Debugln added in v0.1.5

func Debugln(a ...interface{}) (n int, err error)

func Errorf added in v0.1.5

func Errorf(format string, a ...interface{}) (n int, err error)

func Errorln added in v0.1.5

func Errorln(a ...interface{}) (n int, err error)

func Fatalf added in v0.1.5

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

func Fatalln added in v0.1.5

func Fatalln(a ...interface{})

func HttpErrStrip added in v0.1.5

func HttpErrStrip(err error) error

Strip some redundant message from client http error.

func JsonFormatter added in v0.1.5

func JsonFormatter(v interface{}) string

func PrintDict

func PrintDict(u interface{}, keys KeyList, fmts FormatterList)

func PrintList

func PrintList(slice interface{}, keys KeyList, fmts FormatterList)

Output formats slice of structs data and writes to standard output.(Using box drawing characters)

func PrintResponse added in v0.1.5

func PrintResponse(v interface{})

func Printf added in v0.1.5

func Printf(format string, a ...interface{}) (n int, err error)

func Println added in v0.1.5

func Println(a ...interface{}) (n int, err error)

func Run

func Run() error

Run method indicates how to start a cli tool through cobra.

func TableDict

func TableDict(u interface{}, keys KeyList, fmts FormatterList) string

Table formats slice of structs data and returns the resulting string.(Using standard ascii characters)

func TableList

func TableList(slice interface{}, keys KeyList, fmts FormatterList) string

Table formats slice of structs data and returns the resulting string.(Using box drawing characters)

func Warnf added in v0.1.5

func Warnf(format string, a ...interface{}) (n int, err error)

func Warnln added in v0.1.5

func Warnln(a ...interface{}) (n int, err error)

Types

type FormatterList

type FormatterList map[string]func(v interface{}) string

type KeyList

type KeyList []string

type StructElemCb

type StructElemCb func(name string, value reflect.Value) error

type Writer added in v0.1.5

type Writer struct{}

func (Writer) Write added in v0.1.5

func (writer Writer) Write(data []byte) (n int, err error)

do nothing

Jump to

Keyboard shortcuts

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