Skip to content

Instantly share code, notes, and snippets.

@wozozo
Created August 17, 2015 06:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wozozo/50d49f70aa696b55a01b to your computer and use it in GitHub Desktop.
Save wozozo/50d49f70aa696b55a01b to your computer and use it in GitHub Desktop.
fs = require('fs')
# Import ENV from zsh config.
fs.readFile process.env.HOME+"/.zshrc", "utf8", (err, zshFile) ->
envPaths = ['/usr/local/bin']
for l in zshFile.split('\n')
if l.substring(0,11) is 'export PATH'
e = l.split('=').splice(-1)[0]
e = e.replace(':$PATH','').replace(/"/g,'')
if ':' in e
for x in e.split(':')
envPaths.push(x)
else
envPaths.push(e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment