Documentation ¶
Overview ¶
Package cliutil provides some util functions for CLI
Index ¶
- func BinDir() string
- func BinFile() string
- func Bluef(format string, a ...interface{})
- func Blueln(a ...interface{})
- func Bluep(a ...interface{})
- func BuildLine(binFile string, args []string) string
- func CurrentShell(onlyName bool) (path string)
- func Cyanf(format string, a ...interface{})
- func Cyanln(a ...interface{})
- func Cyanp(a ...interface{})
- func Errorf(format string, a ...interface{})
- func Errorln(a ...interface{})
- func Errorp(a ...interface{})
- func ExecCmd(binName string, args []string, workDir ...string) (string, error)
- func ExecCommand(binName string, args []string, workDir ...string) (string, error)
- func ExecLine(cmdLine string, workDir ...string) (string, error)
- func Grayf(format string, a ...interface{})
- func Grayln(a ...interface{})
- func Grayp(a ...interface{})
- func Greenf(format string, a ...interface{})
- func Greenln(a ...interface{})
- func Greenp(a ...interface{})
- func HasShellEnv(shell string) bool
- func Infof(format string, a ...interface{})
- func Infoln(a ...interface{})
- func Infop(a ...interface{})
- func LineBuild(binFile string, args []string) string
- func Magentaf(format string, a ...interface{})
- func Magentaln(a ...interface{})
- func Magentap(a ...interface{})
- func ParseLine(line string) []string
- func QuickExec(cmdLine string, workDir ...string) (string, error)
- func ReadFirst(question string) (string, error)
- func ReadFirstByte(question string) (byte, error)
- func ReadFirstRune(question string) (rune, error)
- func ReadInput(question string) (string, error)
- func ReadLine(question string) (string, error)
- func ReadPassword(question ...string) string
- func Redf(format string, a ...interface{})
- func Redln(a ...interface{})
- func Redp(a ...interface{})
- func ShellExec(cmdLine string, shells ...string) (string, error)
- func String2OSArgs(line string) []string
- func StringToOSArgs(line string) []string
- func Warnf(format string, a ...interface{})
- func Warnln(a ...interface{})
- func Warnp(a ...interface{})
- func Workdir() string
- func Yellowf(format string, a ...interface{})
- func Yellowln(a ...interface{})
- func Yellowp(a ...interface{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Bluef ¶ added in v0.5.3
func Bluef(format string, a ...interface{})
Bluef print message with Blue color
func Blueln ¶ added in v0.5.3
func Blueln(a ...interface{})
Blueln print message line with Blue color
func CurrentShell ¶
CurrentShell get current used shell env file. eg "/bin/zsh" "/bin/bash"
func Cyanf ¶ added in v0.5.3
func Cyanf(format string, a ...interface{})
Cyanf print message with Cyan color
func Cyanln ¶ added in v0.5.3
func Cyanln(a ...interface{})
Cyanln print message line with Cyan color
func Errorf ¶ added in v0.5.3
func Errorf(format string, a ...interface{})
Errorf print message with error style
func Errorln ¶ added in v0.5.3
func Errorln(a ...interface{})
Errorln print message with error style
func ExecCommand ¶
ExecCommand alias of the ExecCmd()
func Grayf ¶ added in v0.5.3
func Grayf(format string, a ...interface{})
Grayf print message with gray color
func Grayln ¶ added in v0.5.3
func Grayln(a ...interface{})
Grayln print message line with gray color
func Greenf ¶ added in v0.5.3
func Greenf(format string, a ...interface{})
Greenf print message with green color
func Greenln ¶ added in v0.5.3
func Greenln(a ...interface{})
Greenln print message line with green color
func Infof ¶ added in v0.5.3
func Infof(format string, a ...interface{})
Infof print message with info style
func Magentaf ¶ added in v0.5.3
func Magentaf(format string, a ...interface{})
Magentaf print message with magenta color
func Magentaln ¶ added in v0.5.3
func Magentaln(a ...interface{})
Magentaln print message line with magenta color
func Magentap ¶ added in v0.5.3
func Magentap(a ...interface{})
Magentap print message with magenta color
func ReadFirstByte ¶ added in v0.3.12
ReadFirstByte read first byte char
Usage:
ans, _ := cliutil.ReadFirstByte("continue?[y/n] ")
func ReadFirstRune ¶ added in v0.3.12
ReadFirstRune read first rune char
func ReadLine ¶ added in v0.3.8
ReadLine read one line from user input.
Usage:
in := cliutil.ReadLine("") ans, _ := cliutil.ReadLine("your name?")
func ReadPassword ¶ added in v0.3.8
ReadPassword from console terminal
func Redf ¶ added in v0.5.3
func Redf(format string, a ...interface{})
Redf print message with Red color
func String2OSArgs ¶ added in v0.3.12
String2OSArgs parse input command line text to os.Args
func StringToOSArgs ¶ added in v0.3.8
StringToOSArgs parse input command line text to os.Args
func Warnf ¶ added in v0.5.3
func Warnf(format string, a ...interface{})
Warnf print message with warn style
func Yellowf ¶ added in v0.5.3
func Yellowf(format string, a ...interface{})
Yellowf print message with yellow color
Types ¶
This section is empty.