upathex
is a package that expands paths like a shell interpreter.
path := upathex.ExpandTilde("~/bin")
// => /home/mdouchement/bin
path := upathex.ExpandTilde("~root/bin")
// => /root/bin
path := upathex.ExpandEnv("$HOME/bin")
// => /home/mdouchement/bin
path := upathex.ExpandEnv("${HOME}/bin")
// => /home/mdouchement/bin
path := upathex.ExpandEnvWithCustom("$TROLOLO/bin", map[string]string{
"TROLOLO": "trololo-lolo",
})
// => trololo-lolo/bin
MIT
All PRs are welcome.
- Fork it
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create new Pull Request