clihelper

package
v1.35.0 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: MIT Imports: 5 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Color

func Color(color CliColor, s string) string

func DefaultReadLineHandler

func DefaultReadLineHandler(b []byte) error

func ReadLine

func ReadLine(ctx context.Context, reader io.Reader, handler CliOutputHandler) error

Readline reads from the reader and calls the handler for each line

Types

type BoolFlag

type BoolFlag struct {
	IsSet bool
	Value bool
}

BoolFlag is a custom flag type to capture if a flag has been explicitly set.

func (*BoolFlag) Set

func (f *BoolFlag) Set(s string) error

Set is the method to set the flag value, part of the flag.Value interface.

func (*BoolFlag) String

func (f *BoolFlag) String() string

String is the method to format the flag's value, part of the flag.Value interface.

type CliColor

type CliColor string
const (
	ColorGreen  CliColor = "\033[0;32m"
	ColorYellow CliColor = "\033[0;33m"
	ColorRed    CliColor = "\033[0;31m"
	ColorReset  CliColor = "\033[0m"
)

type CliOutputHandler

type CliOutputHandler func([]byte) error

CliOutputHandler is a function that handles a line of output

Jump to

Keyboard shortcuts

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