Documentation
¶
Index ¶
- func Bool(v any) bool
- func Cmdline(args []string, binName ...string) string
- func CurrentShell(onlyName bool) (path string)
- func Environ() map[string]string
- func ExecCmd(binName string, args []string, workDir ...string) (string, error)
- func ExpandPath(pathStr string) string
- func FormatTplAndArgs(fmtAndArgs []any) string
- func HasShellEnv(shell string) bool
- func ParseEnvVar(val string, getFn func(string) string) (newVal string)
- func ShellExec(cmdLine string, shells ...string) (string, error)
- func StrToBool(s string) (bool, error)
- func ToBool(v any) (bool, error)
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". if onlyName=true, will return "zsh", "bash"
func ExpandPath ¶
ExpandPath will parse first `~` as user home dir path.
func ParseEnvVar ¶
ParseEnvVar parse ENV var value from input string, support default value.
Format:
${var_name} Only var name ${var_name | default} With default value
Usage:
comfunc.ParseEnvVar("${ APP_NAME }") comfunc.ParseEnvVar("${ APP_ENV | dev }")
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.