Documentation ¶
Overview ¶
Package cliutil provides some util functions for CLI
Index ¶
- func BinDir() string
- func BinFile() string
- func BuildLine(binFile string, args []string) string
- func CurrentShell(onlyName bool) (path string)
- 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 HasShellEnv(shell string) bool
- func LineBuild(binFile string, args []string) string
- 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 ShellExec(cmdLine string, shells ...string) (string, error)
- func String2OSArgs(line string) []string
- func StringToOSArgs(line string) []string
- func Workdir() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CurrentShell ¶
CurrentShell get current used shell env file. eg "/bin/zsh" "/bin/bash"
func ExecCommand ¶
ExecCommand alias of the ExecCmd()
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 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
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.