Documentation ¶
Overview ¶
Package utils provides utilitary functions.
Index ¶
- Constants
- func CenterLine(line string, width int) string
- func ErrorBox(format string, args ...interface{})
- func FileExists(fpath string) (bool, os.FileInfo)
- func FileIsExecutable(fpath string) bool
- func GetHomeDir() string
- func MkdirP(dirname string, mode int) error
- func PanicOnError(fmtstr string, err error)
- func PrintError(fmtstr string, err error) error
- func PrintFailed(format string, args ...interface{})
- func PrintFatal(fmtstr string, err error) error
- func PrintStatus(colorattr color.Attribute, status, format string, args ...interface{})
- func PrintSuccess(format string, args ...interface{})
- func TextBox(title, format string, args ...interface{})
Constants ¶
View Source
const ( WIDTHSUBS int = 20 TitleColor color.Attribute = color.FgMagenta InfoNameColor color.Attribute = color.Bold InfoValueColor color.Attribute = color.FgYellow BranchDefaultColor color.Attribute = color.FgBlue BranchChangedColor color.Attribute = color.FgYellow SuccessColor color.Attribute = color.FgGreen FailureColor color.Attribute = color.FgRed )
Variables ¶
This section is empty.
Functions ¶
func CenterLine ¶ added in v0.4.0
func FileExists ¶
FileExists check if a target exists and is a file.
check, info := utils.FileExists("/etc/passwd") if check { fmt.Printf("size: %d\n", info.Size()) }
func FileIsExecutable ¶
FileIsExecutable file exists and is executable
func PrintError ¶
PrintError if err is not nil print fmtstr as error.
func PrintFailed ¶ added in v0.4.0
func PrintFailed(format string, args ...interface{})
func PrintStatus ¶ added in v0.4.0
func PrintSuccess ¶ added in v0.4.0
func PrintSuccess(format string, args ...interface{})
Types ¶
This section is empty.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.