Documentation
¶
Index ¶
- func CurrentShell(onlyName bool) (path string)
- func ExecCmd(binName string, args []string, workDir ...string) (string, error)
- func ExpandPath(pathStr string) string
- func HasShellEnv(shell string) bool
- func ShellExec(cmdLine string, shells ...string) (string, error)
- func TryStructToMap(st interface{}) (map[string]interface{}, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CurrentShell ¶ added in v0.5.3
CurrentShell get current used shell env file.
eg "/bin/zsh" "/bin/bash". if onlyName=true, will return "zsh", "bash"
func ExecCmd ¶ added in v0.5.3
ExecCmd an command and return output.
Usage:
ExecCmd("ls", []string{"-al"})
func ExpandPath ¶ added in v0.5.3
ExpandPath will parse first `~` as user home dir path.
func HasShellEnv ¶ added in v0.5.3
HasShellEnv has shell env check.
Usage:
HasShellEnv("sh")
HasShellEnv("bash")
func TryStructToMap ¶
TryStructToMap simple convert structs to map by reflect
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.