Documentation ¶
Overview ¶
Package `utils` provides useful functions for simplifying various programming tasks
Index ¶
- Constants
- func ChangeWorkingDir(dir string)
- func ContainsRune(s []rune, e rune) bool
- func ContainsString(s []string, e string) bool
- func ContainsStringPartial(s []string, e string) bool
- func GetFilePathComponents(name string) (string, string, string)
- func MarshalAndPrintJSON(data interface{})
- func PrettyPrint(i interface{}) string
- func RemoveUnquotedMarker(content string) string
- func RemoveUnquotedValueMarker(content string) string
- func SetJSON(parentObj *gabs.Container, childObj *gabs.Container, key string) *gabs.Container
- func UnicodeCategory(r rune) string
- func UpdateSelf()
- type ParseError
Constants ¶
const UNQUOTED_VAR_MARKER = "626f4c60"
The following string fragment is used to mark unquoted variables within a JSON body in the lama2 file. For example, Lama2 parser will mark an unquoted variable `hello` as:
"<626f4c60-${hello}>"
The above string is actually representative of the user intent:
${hello}
Note the lack of quotes around the variable above. This hack is needed to work around Gabs, which is unaware of variables required in the Lama2 system
Variables ¶
This section is empty.
Functions ¶
func ChangeWorkingDir ¶ added in v1.0.4
func ChangeWorkingDir(dir string)
ChangeWorkingDirectory tries to set the CWD; on failure it exits with a log error message
func ContainsRune ¶
ContainsRune searches for rune `e` in a slice of runes `s`; returns a boolean
func ContainsString ¶
ContainsString searches for string `e` in a slice of strings `s`; returns a boolean
func ContainsStringPartial ¶
ContainsStringPartial substring-searches for string `e` in a slice of strings `s`; returns a boolean
func GetFilePathComponents ¶ added in v1.0.4
GetFilePathComponent returns absolute path, directory, and filename given a filepath
func MarshalAndPrintJSON ¶ added in v1.5.6
func MarshalAndPrintJSON(data interface{})
func PrettyPrint ¶
func PrettyPrint(i interface{}) string
PrettyPrint takes in a generic interface{} objects and uses standard JSON capabilities to try to print with indentation
func RemoveUnquotedMarker ¶ added in v1.6.0
func RemoveUnquotedValueMarker ¶ added in v1.6.0
func SetJSON ¶ added in v1.1.0
func SetJSON(parentObj *gabs.Container, childObj *gabs.Container, key string) *gabs.Container
SetJSON is a helper function to work with the `gabs` library, which in turn is an API on top of the standard JSON library The function helps us create `parentObj.key = childObj` through using the `Merge` primitive available in `gabs`
func UnicodeCategory ¶
UnicodeCategory returns the Unicode Character Category of the given rune.
func UpdateSelf ¶ added in v1.1.0
func UpdateSelf()
UpdateSelf downloads the installation script from the official repository, and executes it to update the l2 binary to the latest version
Types ¶
type ParseError ¶
func NewParseError ¶
func NewParseError(pos int, line int, msg string, args []string) *ParseError
func (ParseError) Error ¶
func (p ParseError) Error() string