Documentation
¶
Index ¶
- Constants
- func CheckRW(mode fs.FileMode) error
- func CheckRWX(mode fs.FileMode) error
- func CleanString(s string, othersToEscape ...rune) string
- func CleanStringNoRegex(s string) string
- func EscapeTermString(s string) string
- func IsDir(path string) (bool, error)
- func IsExecutableFile(path string) (bool, error)
- func IsFile(path string) (bool, error)
- func MultilineString(s ...string) string
- func ParseLicenseText(tmpl map[string]string, s string) string
- func ParseTemplateFile(ctx context.Context, tmpl map[string]any, reader *bufio.Scanner, ...) error
- func PathExists(path string) (bool, error)
- func StringStartsWith(s, look string) bool
- func WalkDirRecursive(root string) ([]string, error)
Constants ¶
const ( FilePerms = 0o644 // -rw-r--r-- DirPerms = 0o755 // drwxr-xr-x )
Variables ¶
This section is empty.
Functions ¶
func CleanString ¶
Escapes the given string from common escape sequences in 0(n) time, no regex.
\x1b[31mfoo\x1b[0m -> foo \n\r\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0E\x0F\x7f -> empty
func CleanStringNoRegex ¶
Invokes CleanString to prevent regex
func EscapeTermString ¶
Invokes CleanString with terminal-specific operators like ;|&$.
func IsExecutableFile ¶
func MultilineString ¶
MultilineString provides a pleasing way to write multiline strings.
func ParseLicenseText ¶
ParseLicenseText handles templating license text
func ParseTemplateFile ¶
func ParseTemplateFile(ctx context.Context, tmpl map[string]any, reader *bufio.Scanner, writer *bufio.Writer) error
This handles consuming a file stream, templating it and writing it to writer.
tmpl is a mapping of `find`: `replace`.
`find` should be X where the actual template searched for is "{{X}}" {{{x}}}
Time complexity through the roof: HAVE TO OPTIMIZE
func PathExists ¶
func StringStartsWith ¶
StringStartsWith returns true if the given string starts with the given string look, or if they start similarly.
func WalkDirRecursive ¶
Types ¶
This section is empty.