prezto/modules/node/functions/node-doc
Indrajit Raychaudhuri af46875c5e node: Revamp and optimize 'node' module
Changes:
- nodenv and nvm now honors (and prioritizes) `$XDG_CONFIG_HOME` over
  `$HOME` to lookup local nodenv/nvm installation.
- Make `nvm` loading lazy (via `--no-use` argument).
- Remove redundant NODENV_ROOT or NVM_DIR, respective script already
  set them up.
- Adhere to more idiomatic Zsh operation and minimize external command
  usage (like `sed`).
2021-05-21 13:39:23 -05:00

19 lines
378 B
Plaintext

#
# Opens the Node.js online API documentation in the default browser.
#
# Authors:
# Sorin Ionescu <sorin.ionescu@gmail.com>
#
# function node-doc {
if [[ -z "$BROWSER" ]]; then
print "$0: no web browser defined" >&2
return 1
fi
# TODO: Make the sections easier to use.
"$BROWSER" "https://nodejs.org/docs/${$(node --version 2> /dev/null)/%-*}/api/all.html#${1}"
# }