helper

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2023 License: Apache-2.0 Imports: 18 Imported by: 2

Documentation

Index

Constants

View Source
const DetachedFlag = "detached"

DetachedFlag ...

View Source
const DetachedShortFlag = "d"

DetachedShortFlag ...

Variables

View Source
var Blue = "\033[34m"

Blue ...

View Source
var Cyan = "\033[36m"

Cyan ...

View Source
var Green = "\033[32m"

Green ...

View Source
var Purple = "\033[35m"

Purple ...

View Source
var Red = "\033[31m"

Red ...

View Source
var Reset = "\033[0m"

Reset resets the color

View Source
var White = "\033[37m"

White ...

View Source
var Yellow = "\033[33m"

Yellow ...

Functions

func NewPlauncher added in v0.7.0

func NewPlauncher() *plauncher

func NewTerminalReader added in v0.7.0

func NewTerminalReader(r io.Reader) *terminalReader

func OverrideQuitter added in v1.0.5

func OverrideQuitter(quitter func(int))

func PrintTable

func PrintTable(
	w io.Writer,
	cols []string,
	nbRows int,
	getRow func(int) []string,
	caption string,
)

PrintTable prints data (string arrays) in a tabular format

func PrintfColorW added in v0.7.0

func PrintfColorW(w io.Writer, color string, format string, args ...interface{})

PrintfColorW ...

func QuitToStdErr

func QuitToStdErr(msg interface{})

QuitToStdErr prints an error on stderr and closes

func QuitWithUserError

func QuitWithUserError(err error)

QuitWithUserError ...

func ResolvePath

func ResolvePath(origPath string, parse bool) (finalPath string, err error)

ResolvePath ...

Types

type Config added in v0.7.1

type Config struct {
	Name  string // default config file name
	CfgFn string // bind with flag config (config file submitted by user, it overrides default)
}

Options cmd options

func (*Config) Init added in v0.7.1

func (c *Config) Init(name string) error

Init initializes config

func (*Config) LoadConfig added in v0.7.1

func (c *Config) LoadConfig(cmd *cobra.Command) (err error)

LoadConfig loads the config file (if any) and initializes the config

type Execs added in v0.7.0

type Execs interface {
	Command(name string, arg ...string) *exec.Cmd
}

type PasswordReader

type PasswordReader interface {
	Read(string) ([]byte, error)
}

PasswordReader ...

var DefaultPasswordReader PasswordReader = stdinPasswordReader{/* contains filtered or unexported fields */}

DefaultPasswordReader ...

type Plauncher added in v0.7.0

type Plauncher interface {
	Detached() error
}

type TerminalReadPw added in v0.7.0

type TerminalReadPw interface {
	ReadPassword(fd int) ([]byte, error)
}

type TerminalReader added in v0.7.0

type TerminalReader interface {
	ReadFromTerminalYN(def string) (selected string, err error)
}

Jump to

Keyboard shortcuts

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