expandpath

package
v0.7.8 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DisableCache bool

TODO refactor later DisableCache will disable caching of the homeCaps directory. Caching is enabled by default.

Functions

func ExpandEnvironmentVariable added in v0.2.6

func ExpandEnvironmentVariable(envInfoItems []EnvKeyInfo) map[string]string

ExpandEnvironmentVariable

function takes an array of environment variables (string) as input
and outputs a map of expanded path of those variables if the paths exist.

func ExpandVariables added in v0.2.5

func ExpandVariables(pathContainsEnvVariables string) string

ExpandVariables

function takes a string input and replaces any word that starts with "$" in the input with its expanded path (if exists) and returns the new string.

Acceptable Env paths:

${Java_home} $java_home %{java_home} %java_home all will be expanded

func ExpandVariablesIf added in v0.2.5

func ExpandVariablesIf(
	isExpand bool,
	pathContainsEnvVariables string,
) string

ExpandVariablesIf

Acceptable Env paths: ${Java_home} $java_home %{java_home} %java_home all will be expand e

func GetCompiledPath added in v0.2.4

func GetCompiledPath(
	pathTemplate string,
	compilingMap map[string]string,
) string

GetCompiledPath

exactly replaces as is.

func GetEnvironmentVariables

func GetEnvironmentVariables(
	pathContainsEnvVarStartingDollarSymbol string,
) []string

getVariables function takes a string input and identifies every word that begins with "$" or every word within two "%" in that input string then returns an array of those words. If input is empty or has no such word then returns nil.

func Home

func Home(path string) (string, *errorwrapper.Wrapper)

Home expands the path to include the homeCaps directory if the path is prefixed with `~`. If it isn't prefixed with `~`, the path is returned as-is. Reference : https://bit.ly/3rZbbKH

Types

type EnvKeyInfo added in v0.2.4

type EnvKeyInfo struct {
	GivenAs,
	SimplifiedName string
}

func GetDollarOrPercentSymbolIdentifierEnvInfoItems added in v0.6.1

func GetDollarOrPercentSymbolIdentifierEnvInfoItems(
	stringToCheck string,
) []EnvKeyInfo

func GetEnvInfoItemsKeyNames added in v0.6.1

func GetEnvInfoItemsKeyNames(slice []string) []EnvKeyInfo

GetEnvInfoItemsKeyNames

will be retrieved from slice strings

Key Names may be formatter like:

${identifier} or $identifier or %{identifier} or %identifier

returns exact keys as given ${identifier} will be returns as given ${identifier}

Jump to

Keyboard shortcuts

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