Documentation ¶
Index ¶
- Variables
- func BackupDirectory(sourceDir string, backupDir string) (bool, error)
- func Base64String(path string) (string, error)
- func Contains(find string, list []string) bool
- func CreateDir(dir string, perm os.FileMode) error
- func GetIPFromCIDR(cidr string, n int) (net.IP, error)
- func Intersects(first, second []string) bool
- func PrettyPrint(out io.Writer, msg string, a ...interface{})
- func PrettyPrintErr(out io.Writer, msg string, a ...interface{})
- func PrettyPrintErrorIgnored(out io.Writer, msg string, a ...interface{})
- func PrettyPrintOk(out io.Writer, msg string, a ...interface{})
- func PrettyPrintSkipped(out io.Writer, msg string, a ...interface{})
- func PrettyPrintUnreachable(out io.Writer, msg string, a ...interface{})
- func PrettyPrintWarn(out io.Writer, msg string, a ...interface{})
- func PrintColor(out io.Writer, clr *color.Color, msg string, a ...interface{})
- func PrintError(out io.Writer)
- func PrintHeader(out io.Writer, msg string, padding byte)
- func PrintOk(out io.Writer)
- func PrintOkln(out io.Writer)
- func PrintSkipped(out io.Writer)
- func PrintTable(out io.Writer, msgMap map[string][]string)
- func PrintValidationErrors(out io.Writer, errors []error)
- func PrintWarn(out io.Writer)
- func PromptForInt(in io.Reader, out io.Writer, prompt string, defaultValue int) (int, error)
- func PromptForString(in io.Reader, out io.Writer, prompt string, defaultValue string, ...) (string, error)
- func Subset(first, second []string) bool
- type LineReader
Constants ¶
This section is empty.
Variables ¶
var Blue = color.New(color.FgCyan)
var Green = color.New(color.FgGreen)
var Red = color.New(color.FgRed)
var White = color.New(color.FgHiWhite)
Functions ¶
func BackupDirectory ¶ added in v1.3.3
BackupDirectory checks for existence of the $sourceDir and backs it up to backupDir
func Base64String ¶
Base64String read file and return base64 string
func GetIPFromCIDR ¶
GetIPFromCIDR Naive implementation, but works
func Intersects ¶ added in v1.3.0
Intersects returns true if any element from the first slice is in the second slice
func PrettyPrint ¶
PrettyPrint no type will be displayed, used for just single line printing
func PrettyPrintErr ¶
PrettyPrintErr [ERROR](Red) with formatted string
func PrettyPrintErrorIgnored ¶
PrettyPrintErrorIgnored [ERROR IGNORED](Red) with formatted string
func PrettyPrintOk ¶
PrettyPrintOk [OK](Green) with formatted string
func PrettyPrintSkipped ¶
PrettyPrintSkipped [SKIPPED](blue) with formatted string
func PrettyPrintUnreachable ¶
PrettyPrintUnreachable [UNREACHABLE](Red) with formatted string
func PrettyPrintWarn ¶
PrettyPrintWarn [WARNING](Orange) with formatted string
func PrintColor ¶
PrintColor prints text in color
func PrintError ¶
PrintError print whole message in error(Red) format
func PrintHeader ¶
PrintHeader will print header with predifined width
func PrintSkipped ¶
PrintSkipped print whole message in green(Red) format
func PrintValidationErrors ¶ added in v1.2.0
PrintValidationErrors loops through the errors
func PromptForInt ¶
PromptForInt read command line input
func PromptForString ¶ added in v1.4.0
Types ¶
type LineReader ¶ added in v1.4.1
type LineReader struct {
// contains filtered or unexported fields
}
LineReader provides a way to read lines of text with arbitrary length. The line is buffered in memory.
func NewLineReader ¶ added in v1.4.1
func NewLineReader(r io.Reader, bufSizeBytes int) LineReader
NewLineReader returns a LineReader to read from r. It wraps the reader with a buffered reader that has a buffer of size bufSizeBytes.
func (LineReader) Read ¶ added in v1.4.1
func (lr LineReader) Read() ([]byte, error)
Read an entire line from the reader.