Documentation
¶
Index ¶
- Constants
- func AddScript(cmd *cobra.Command, filePath string) error
- func AwaitShellSnippet(snippet string, env map[string]string, cliArgs []string) (int, error)
- func CaptureShellSnippet(snippet string, env map[string]string) (string, int, error)
- func Exec(command string, args []string, env map[string]string) (int, error)
- func FindScripts(rootCmd *cobra.Command, folderGlob string)
- func GetShellPath() string
- type ScriptInfo
- type ScriptMap
Constants ¶
View Source
const ERR_ESTRPIPE = 86
error codes from https://adminschoice.com/exit-error-codes-in-bash-and-linux-os/
View Source
const KeywordLong = "extra"
View Source
const KeywordShort = "short"
View Source
const KeywordUse = "clog"
Variables ¶
This section is empty.
Functions ¶
func AwaitShellSnippet ¶
Execute a shell snippet and stream the result, stdError & return status
func CaptureShellSnippet ¶
Execute a shell snippet and get the result, return code and sys error
func FindScripts ¶
Add scripts from clogrc folder
Types ¶
type ScriptInfo ¶
type ScriptInfo struct {
CmdUse string
CmdShort string
CmdLong string
NeedsOpts bool
FilePath string
}
func ParseScriptInfo ¶
func ParseScriptInfo(filePath string) (*ScriptInfo, error)
scan a script file and create a map of the data found First 3 lines should be of the format:
# clog> command [opts] # optional short help
# short> a short help explanation\
# that can be multi-line using backslashes
# extra> long help printed when --help is used
type ScriptMap ¶
type ScriptMap map[string]ScriptInfo
Click to show internal directories.
Click to hide internal directories.