expandpath

package
v0.4.9 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2021 License: MIT Imports: 16 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(envInfos *[]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 expand e

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

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 GetDollarOrPercentSymbolIdentifierEnvInfos added in v0.2.6

func GetDollarOrPercentSymbolIdentifierEnvInfos(
	stringToCheck string,
) []EnvKeyInfo

func GetEnvInfosKeyNames added in v0.2.6

func GetEnvInfosKeyNames(slice []string) []EnvKeyInfo

GetEnvInfosKeyNames will be retrieved from slice strings

Key Names may be formatter like :

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

Jump to

Keyboard shortcuts

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