Documentation ¶
Index ¶
- func DeleteFile(dst string) (err error)
- func FileExists(filepath string) bool
- func LaunchEditor(editor string, fnamegetter func() string) (content []byte, err error)
- func LaunchEditorWith(editor, filename string) (content []byte, err error)
- func Must[T constraints.Float | constraints.Integer](s string) T
- func N[T constraints.Float | constraints.Integer](s string) (ret T, err error)
- func ParseT[T Parseable](str string) (T, error)
- func ReadFile(filename string) ([]byte, error)
- func SplitCommandString(s string, quoteChars ...rune) []string
- func StringToBool(val string, defaultVal ...bool) (ret bool)
- func StripQuotes(s string) string
- func ToBool(val any, defaultVal ...bool) (ret bool)
- func TrimQuotes(s string) string
- type Parseable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FileExists ¶
FileExists returns the existence of an directory or file
func LaunchEditor ¶
LaunchEditor launches the specified editor
func LaunchEditorWith ¶
LaunchEditorWith launches the specified editor with a filename
func Must ¶
func Must[T constraints.Float | constraints.Integer](s string) T
func N ¶
func N[T constraints.Float | constraints.Integer](s string) (ret T, err error)
func ReadFile ¶
ReadFile reads the file named by filename and returns the contents. A successful call returns err == nil, not err == EOF. Because ReadFile reads the whole file, it does not treat an EOF from Read as an error to be reported.
As of Go 1.16, this function simply calls os.ReadFile.
func SplitCommandString ¶
SplitCommandString allows split command-line by quote characters (default is double-quote).
In: `bash -c 'echo hello world!'` Out: []string{ "bash", "-c", "echo hello world!"}
func StringToBool ¶
func StripQuotes ¶
StripQuotes strips first and last quote char (double quote or single quote).
func TrimQuotes ¶
TrimQuotes strips first and last quote char (double quote or single quote).