Skip to content

mdouchement/upathex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

upathex

upathex is a package that expands paths like a shell interpreter.

Usage

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

License

MIT

Contributing

All PRs are welcome.

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request