Categorygithub.com/alex-held/expand
repositorypackage
1.0.1
Repository: https://github.com/alex-held/expand.git
Documentation: pkg.go.dev

# README

Welcome to expand šŸ‘‹

Twitter: 0_alexheld

Go_Version Go Reference

Expands variables recursivly using a dependency graph algorithm

šŸ  Homepage

Install

go get github.com/alex-held/expand

Usage

func main() {
	vars := map[string]string{
	    "a": "$HOME/$b/$c",
		"b": "$c/foo",
		"c": "bar",
		"HOME": "/home/user" // override environment variable
    }   
	
	expansions, err := expand.Expand(vars)
	if err != nil {
	   panic(err)
	}
	
	println(expansions.MustGet("a"))
	
	// Outputs:
	// /home/user/bar/foo/bar
}

Run tests

go test -v ./...

Author

šŸ‘¤ Alexander Held

Show your support

Give a ā­ļø if this project helped you!