Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Welcome to expand 👋

Twitter: 0_alexheld

Go_Version Go Reference

Expands variables recursivly using a dependency graph algorithm

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!

Releases

Packages

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.