Documentation ¶
Index ¶
- Constants
- func CobraRootInitBoilerPlate(confMap map[string]string, crashOnErr bool) map[string]string
- func Confirmed(prompt string) bool
- func FileExists(path string) bool
- func GetDir(path string) []fs.FileInfo
- func GetDirContents(dirName string) map[string]interface{}
- func GetDirContentsExclusive(dirName string, notExcludedByFunc func(string) bool) map[string]interface{}
- func GetDirFiles(path string) []string
- func GetDirFilesExclusive(path string, notExcludedByFunc func(string) bool) []string
- func GetFile(path string) []byte
- func GetInput() string
- func IsValidInput(a string) bool
- func Make(s string) *str
- func NotConfig(name string) bool
- func PrintInvalid(inp string)
- func PrintPrompt(kind, toolName string)
- func ReplaceHomeDir(s string, crashOnErr bool) string
- func RunConfPrompts(toolName string, confMap map[string]string, defaults []string)
- func SearchInDirNames(dirPath, searchStr string) []string
- func SelectBetween(explanation string, args []string) string
- func Throw(err string)
- func ThrowQuiet(s string)
- func ThrowSys(funcCulprit interface{}, err error)
- func ThrowTooFewArgs(cmd string)
- func ThrowTooManyArgs(cmd string)
- func ThrowUnhandled(err error)
- func ThrowX(err error, desc string)
- func ToJson(i interface{}) map[string]interface{}
Constants ¶
const Perm = 0755
Variables ¶
This section is empty.
Functions ¶
func CobraRootInitBoilerPlate ¶
Expects "confDir" and possibly a "dataDir" in the map argument; returns these same values with the $USER, $HOME, or '~' strings replaced with the actual $HOME value.
Left open to multiple data dirs in the future.
func FileExists ¶
Checks if file exists by tagging os.Stat; came about as tics needs a way to check which of the consuming CLIs' dependent files tripped the config error.
func GetDirContents ¶
func GetDirContentsExclusive ¶
func GetDirFiles ¶
func GetDirFilesExclusive ¶
func IsValidInput ¶
func Make ¶
func Make(s string) *str
Creates an intermediate 'tic' for string chain processing. Call var.String() to unwrap out of the container.
func PrintInvalid ¶
func PrintInvalid(inp string)
func PrintPrompt ¶
func PrintPrompt(kind, toolName string)
func ReplaceHomeDir ¶
Replaces the $USER / $HOME / ~ in the string arg and returns the str with actual system homeDir. Retains crashOnErr from the parent function, or from arg.
func RunConfPrompts ¶
Runs the interactive prompts that create the default config and data dirs where this given CLI lives.
func SearchInDirNames ¶
func SelectBetween ¶
Literally just a wrapper around promptui, but reflects on errs, and is reusable for my libs.
func ThrowQuiet ¶
func ThrowQuiet(s string)
func ThrowSys ¶
func ThrowSys(funcCulprit interface{}, err error)
An unrecoverable error with a descriptive package pointer to what went wrong.
func ThrowTooFewArgs ¶
func ThrowTooFewArgs(cmd string)
func ThrowTooManyArgs ¶
func ThrowTooManyArgs(cmd string)
func ThrowUnhandled ¶
func ThrowUnhandled(err error)
Types ¶
This section is empty.