util

package
v4.2.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoesCommandOuputContain

func DoesCommandOuputContain(cmd []string, value string) bool

DoesCommandOuputContain runs the given command and returns whether its output contains the given string.

func DoesCommandOuputContainLine

func DoesCommandOuputContainLine(cmd []string, value string) bool

DoesCommandOuputContainLine runs the given command and returns whether its output contains the given string as an entire line.

func DoesFileExist

func DoesFileExist(filename string) bool

DoesFileExist returns whether or not a file exists at the given path

func DoesStringArrayContain

func DoesStringArrayContain(list []string, value string) bool

DoesStringArrayContain returns whether the given string slice contains the given string.

func Ensure

func Ensure(condition bool, error string)

Ensure asserts that the given condition is true. If not, it ends the application with the given error message.

func ExitWithErrorMessage

func ExitWithErrorMessage(messages ...string)

ExitWithErrorMessage prints the given error message and terminates the application.

func GetCommandOutput

func GetCommandOutput(cmd ...string) string

GetCommandOutput runs the given command and returns its output.

func GetFullCommandOutput

func GetFullCommandOutput(cmd ...string) (string, error)

GetFullCommandOutput runs the given command and returns its output and error

func GetOpenBrowserCommand

func GetOpenBrowserCommand() string

GetOpenBrowserCommand returns the command to run on the console to open the default browser.

func GetUserInput

func GetUserInput() string

GetUserInput reads input from the user and returns it.

func Indent

func Indent(message string, level int) string

Indent outputs the given string with the given level of indentation on each line. Each level of indentation is two spaces.

func Pluralize

func Pluralize(count, word string) string

Pluralize outputs the count and the word. The word is made plural if the count isn't one

func PrintError

func PrintError(messages ...string)

PrintError prints the given error message to the console.

func PrintLabelAndValue

func PrintLabelAndValue(label, value string)

PrintLabelAndValue prints the label bolded and underlined the value indented on the next line followed by an empty line

func RemoveStringFromSlice

func RemoveStringFromSlice(list []string, value string) (result []string)

RemoveStringFromSlice returns a new string slice which is the given string slice with the given string removed

func StringToBool

func StringToBool(arg string) bool

StringToBool parses the given string into a bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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