Documentation
¶
Overview ¶
Package cliutil provides some util functions for CLI
Index ¶
- 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 HasShellEnv(shell string) bool
- func ParseLine(line string) []string
- func QuickExec(cmdLine string, workDir ...string) (string, error)
- func ReadFirst(question string) (string, 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 StringToOSArgs(line string) []string
- type LineParser
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 ReadLine ¶ added in v0.3.8
ReadLine read one line from user input. Usage:
in := ReadLine("")
ans, _ := ReadLine("your name?")
func ReadPassword ¶ added in v0.3.8
ReadPassword from console terminal
func StringToOSArgs ¶ added in v0.3.8
StringToOSArgs parse input command line text to os.Args
Types ¶
type LineParser ¶ added in v0.3.8
type LineParser struct {
// Line the full input command line text
// eg `kite top sub -a "the a message" --foo val1 --bar "val 2"`
Line string
// contains filtered or unexported fields
}
LineParser struct parse input command line to []string, such as cli os.Args
func (*LineParser) Parse ¶ added in v0.3.8
func (p *LineParser) Parse() []string
Parse input command line text to os.Args
Click to show internal directories.
Click to hide internal directories.