Skip to content

Instantly share code, notes, and snippets.

@larzconwell
Created February 4, 2013 18:48
Show Gist options
  • Save larzconwell/4708667 to your computer and use it in GitHub Desktop.
Save larzconwell/4708667 to your computer and use it in GitHub Desktop.
# Open node documentation in your browser.
# Usage: node-docs [module=all] [version=$(node --version)]
function node-docs() {
local version="$(node --version)"
local module="all"
local url="http://nodejs.org/docs/"
if [[ "$2" != "" ]]; then
version="v$2"
fi
if [[ "$1" != "" ]]; then
module="$1"
fi
url+="$version/api/$module.html"
if test -f "$(which xdg-open)"; then
nohup xdg-open "$url" >> /dev/null 2>&1
else
nohup open "$url" >> /dev/null 2>&1
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment