util

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2017 License: Apache-2.0 Imports: 13 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

Functions

func Base64String

func Base64String(path string) (string, error)

Base64String read file and return base64 string

func CreateDir

func CreateDir(dir string, perm os.FileMode) error

CreateDir check if directory exists and create it

func GetIPFromCIDR

func GetIPFromCIDR(cidr string, n int) (net.IP, error)

GetIPFromCIDR Naive implementation, but works

func HTTPGet added in v1.2.0

func HTTPGet(url string, timeout time.Duration, insecure bool) (int, error)

HTTPGet a proxy to http.Get with timeout and insecure cert timeout of 0 means no timeout

func PrettyPrint

func PrettyPrint(out io.Writer, msg string, a ...interface{})

PrettyPrint no type will be displayed, used for just single line printing

func PrettyPrintErr

func PrettyPrintErr(out io.Writer, msg string, a ...interface{})

PrettyPrintErr [ERROR](Red) with formatted string

func PrettyPrintErrorIgnored

func PrettyPrintErrorIgnored(out io.Writer, msg string, a ...interface{})

PrettyPrintErrorIgnored [ERROR IGNORED](Red) with formatted string

func PrettyPrintOk

func PrettyPrintOk(out io.Writer, msg string, a ...interface{})

PrettyPrintOk [OK](Green) with formatted string

func PrettyPrintSkipped

func PrettyPrintSkipped(out io.Writer, msg string, a ...interface{})

PrettyPrintSkipped [SKIPPED](blue) with formatted string

func PrettyPrintUnreachable

func PrettyPrintUnreachable(out io.Writer, msg string, a ...interface{})

PrettyPrintUnreachable [UNREACHABLE](Red) with formatted string

func PrettyPrintWarn

func PrettyPrintWarn(out io.Writer, msg string, a ...interface{})

PrettyPrintWarn [WARNING](Orange) with formatted string

func PrintColor

func PrintColor(out io.Writer, clr *color.Color, msg string, a ...interface{})

PrintColor prints text in color

func PrintError

func PrintError(out io.Writer)

PrintError print whole message in error(Red) format

func PrintHeader

func PrintHeader(out io.Writer, msg string, padding byte)

PrintHeader will print header with predifined width

func PrintOk

func PrintOk(out io.Writer)

PrintOk print whole message in green(Red) format

func PrintOkln

func PrintOkln(out io.Writer)

PrintOkln print whole message in green(Red) format

func PrintSkipped

func PrintSkipped(out io.Writer)

PrintSkipped print whole message in green(Red) format

func PrintValidationErrors added in v1.2.0

func PrintValidationErrors(out io.Writer, errors []error)

PrintValidationErrors loops through the errors

func PrintWarn

func PrintWarn(out io.Writer)

PrintWarn print whole message in warn(Orange) format

func PromptForInt

func PromptForInt(in io.Reader, out io.Writer, prompt string, defaultValue int) (int, error)

PromptForInt read command line input

func Subset added in v1.2.0

func Subset(first, second []string) bool

Subset returns true if the first array is completely contained in the second array

Types

This section is empty.

Jump to

Keyboard shortcuts

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