util

package
v0.0.0-...-2577f20 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains

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

Checks whether the element e is in the list of strings s

func ExpandPath

func ExpandPath(path string) (string, error)

ExpandPath (path) resolves leading "~/" to user's HomeDir returns expanded path, error

func GetEnvVar

func GetEnvVar(env *object.Environment, varName, defaultVal string) string

GetEnvVar (varName, defaultVal) Return the varName value from the ABS env, or OS env, or default value in that order

func InterpolateStringVars

func InterpolateStringVars(str string, env *object.Environment) string

InterpolateStringVars (str, env) return input string with $vars interpolated from environment

func IsNumber

func IsNumber(s string) bool

func Mapify

func Mapify(list []object.Object) map[string]object.Object

Mapify converts a list of objects to a map. This is useful when you want to test whether elements of a list are present in another list: You can mapify the first one and check whether elements of the second one would occupy the same key in the map.

func UnaliasPath

func UnaliasPath(path string, packageAlias map[string]string) string

UnaliasPath translates a path alias to the full path in the filesystem.

func UniqueStrings

func UniqueStrings(slice []string) []string

UniqueStrings takes an input list of strings and returns a version without duplicate values

func UpdateAvailable

func UpdateAvailable(version string) (string, bool)

Returns latest version, plus "new version available?" bool

Types

This section is empty.

Jump to

Keyboard shortcuts

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