clis

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: BSD-3-Clause Imports: 5 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AbortOn

func AbortOn(errCase string, e error)

AbortOn will quit on the anticipated error gracefully without stack trace

func Abs

func Abs(x int) int

Abs returns the absolute value of x.

func Basename

func Basename(s string) string

Basename returns the file name without extension.

func GetInputStream added in v1.5.3

func GetInputStream(fileName string) io.ReadCloser

GetInputStream will return the file reading handler to the given file, or stdin for "-". It'll abort the program if error occurs.

func GetOutputStream added in v1.5.3

func GetOutputStream(fileName string) io.WriteCloser

GetOutputStream will return the file writing handler to the given file, or stdout for "-". It'll abort the program if error occurs.

func IsExist

func IsExist(fileName string) bool

IsExist checks if the given file exist

func ReadInput added in v1.5.3

func ReadInput(fileName string) []byte

ReadInput reads from the given file name (or "-" for stdin) and abort the program if error occurs.

func Setup

func Setup(p string, v int)

func Verbose

func Verbose(levelSet int, format string, args ...interface{})

Verbose will print info to stderr according to the verbose level setting

func WarnOn

func WarnOn(errCase string, e error) bool

WarnOn will print the error message as a Warning, if applicable, and retur true if so. For a suggested format of "ActionName, step name", the output would be

[progname] Warning: ActionName, step name, sql: Rows are closed

func Warning

func Warning(m string)

Warning will print the given string as a Warning

Types

type OptsT

type OptsT struct {
	Verbose int
}

The OptsT type defines all the configurable options from cli.

var (
	Opts OptsT
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳