utils

package
v1.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 6, 2023 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package `utils` provides useful functions for simplifying various programming tasks

Index

Constants

This section is empty.

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

func ContainsRune(s []rune, e rune) bool

ContainsRune searches for rune `e` in a slice of runes `s`; returns a boolean

func ContainsString

func ContainsString(s []string, e string) bool

ContainsString searches for string `e` in a slice of strings `s`; returns a boolean

func ContainsStringPartial

func ContainsStringPartial(s []string, e string) bool

ContainsStringPartial substring-searches for string `e` in a slice of strings `s`; returns a boolean

func GetFilePathComponents added in v1.0.4

func GetFilePathComponents(name string) (string, string, string)

GetFilePathComponent returns absolute path, directory, and filename given a filepath

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 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

func UnicodeCategory(r rune) string

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

type ParseError struct {
	Pos     int
	LineNum int
	// contains filtered or unexported fields
}

func NewParseError

func NewParseError(pos int, line int, msg string, args []string) *ParseError

func (ParseError) Error

func (p ParseError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL