Advertisement
opexxx

nave.sh

Nov 24th, 2013
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 15.96 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # This program contains parts of narwhal's "sea" program,
  4. # as well as bits borrowed from Tim Caswell's "nvm"
  5.  
  6. # nave install <version>
  7. # Fetch the version of node and install it in nave's folder.
  8.  
  9. # nave use <version>
  10. # Install the <version> if it isn't already, and then start
  11. # a subshell with that version's folder at the start of the
  12. # $PATH
  13.  
  14. # nave use <version> program.js
  15. # Like "nave use", but have the subshell start the program.js
  16. # immediately.
  17.  
  18. # When told to use a version:
  19. # Ensure that the version exists, install it, and
  20. # then add its prefix to the PATH, and start a subshell.
  21.  
  22. if [ "$NAVE_DEBUG" != "" ]; then
  23.   set -x
  24. fi
  25.  
  26. if [ -z "$BASH" ]; then
  27.   cat >&2 <<MSG
  28. Nave is a bash program, and must be run with bash.
  29. MSG
  30.   exit 1
  31. fi
  32.  
  33. shell=`basename "$SHELL"`
  34. case "$shell" in
  35.   bash) ;;
  36.   zsh) ;;
  37.   *)
  38.     echo "Nave only supports zsh and bash shells." >&2
  39.     exit 1
  40.     ;;
  41. esac
  42.  
  43. # Use fancy pants globs
  44. shopt -s extglob
  45.  
  46. # Try to figure out the os and arch for binary fetching
  47. uname="$(uname -a)"
  48. os=
  49. arch=x86
  50. case "$uname" in
  51.   Linux\ *) os=linux ;;
  52.   Darwin\ *) os=darwin ;;
  53.   SunOS\ *) os=sunos ;;
  54. esac
  55. case "$uname" in
  56.   *x86_64*) arch=x64 ;;
  57. esac
  58.  
  59. tar=${TAR-tar}
  60.  
  61. main () {
  62.   local SELF_PATH DIR SYM
  63.   # get the absolute path of the executable
  64.   SELF_PATH="$0"
  65.   if [ "${SELF_PATH:0:1}" != "." ] && [ "${SELF_PATH:0:1}" != "/" ]; then
  66.     SELF_PATH=./"$SELF_PATH"
  67.   fi
  68.   SELF_PATH=$( cd -P -- "$(dirname -- "$SELF_PATH")" \
  69.             && pwd -P \
  70.             ) && SELF_PATH=$SELF_PATH/$(basename -- "$0")
  71.  
  72.   # resolve symlinks
  73.   while [ -h "$SELF_PATH" ]; do
  74.     DIR=$(dirname -- "$SELF_PATH")
  75.     SYM=$(readlink -- "$SELF_PATH")
  76.     SELF_PATH=$( cd -- "$DIR" \
  77.               && cd -- $(dirname -- "$SYM") \
  78.               && pwd \
  79.               )/$(basename -- "$SYM")
  80.   done
  81.  
  82.   if ! [ -d "$NAVE_DIR" ]; then
  83.     if [ -d "$HOME" ]; then
  84.       NAVE_DIR="$HOME"/.nave
  85.     else
  86.       NAVE_DIR=/usr/local/lib/nave
  87.     fi
  88.   fi
  89.   if ! [ -d "$NAVE_DIR" ] && ! mkdir -p -- "$NAVE_DIR"; then
  90.     NAVE_DIR="$(dirname -- "$SELF_PATH")"
  91.   fi
  92.  
  93.   # set up the naverc init file.
  94.   # For zsh compatibility, we name this file ".zshenv" instead of
  95.   # the more reasonable "naverc" name.
  96.   # Important! Update this number any time the init content is changed.
  97.   local rcversion="#3"
  98.   local rcfile="$NAVE_DIR/.zshenv"
  99.   if ! [ -f "$rcfile" ] \
  100.       || [ "$(head -n1 "$rcfile")" != "$rcversion" ]; then
  101.  
  102.     cat > "$rcfile" <<RC
  103. $rcversion
  104. [ "\$NAVE_DEBUG" != "" ] && set -x || true
  105. if [ "\$BASH" != "" ]; then
  106.   if [ "\$NAVE_LOGIN" != "" ]; then
  107.     [ -f ~/.bash_profile ] && . ~/.bash_profile || true
  108.     [ -f ~/.bash_login ] && .  ~/.bash_login || true
  109.     [ -f ~/.profile ] && . ~/.profile || true
  110.   else
  111.     [ -f ~/.bashrc ] && . ~/.bashrc || true
  112.   fi
  113. else
  114.   [ -f ~/.zshenv ] && . ~/.zshenv || true
  115.   export DISABLE_AUTO_UPDATE=true
  116.   if [ "\$NAVE_LOGIN" != "" ]; then
  117.     [ -f ~/.zprofile ] && . ~/.zprofile || true
  118.     [ -f ~/.zshrc ] && . ~/.zshrc || true
  119.     [ -f ~/.zlogin ] && . ~/.zlogin || true
  120.   else
  121.     [ -f ~/.zshrc ] && . ~/.zshrc || true
  122.   fi
  123. fi
  124. unset ZDOTDIR
  125. export PATH=\$NAVEPATH:\$PATH
  126. [ -f ~/.naverc ] && . ~/.naverc || true
  127. RC
  128.  
  129.     cat > "$NAVE_DIR/.zlogout" <<RC
  130. [ -f ~/.zlogout ] && . ~/.zlogout || true
  131. RC
  132.  
  133.   fi
  134.  
  135.   # couldn't write file
  136.   if ! [ -f "$rcfile" ] || [ "$(head -n1 "$rcfile")" != "$rcversion" ]; then
  137.     fail "Nave dir $NAVE_DIR is not writable."
  138.   fi
  139.  
  140.   export NAVE_DIR
  141.   export NAVE_SRC="$NAVE_DIR/src"
  142.   export NAVE_ROOT="$NAVE_DIR/installed"
  143.   ensure_dir "$NAVE_SRC"
  144.   ensure_dir "$NAVE_ROOT"
  145.  
  146.   local cmd="$1"
  147.   shift
  148.   case $cmd in
  149.     ls-remote | ls-all)
  150.       cmd="nave_${cmd/-/_}"
  151.       ;;
  152. #    use)
  153. #      cmd="nave_named"
  154. #      ;;
  155.     install | fetch | use | clean | test | named | \
  156.     ls |  uninstall | usemain | latest | stable | has | installed )
  157.       cmd="nave_$cmd"
  158.       ;;
  159.     * )
  160.       cmd="nave_help"
  161.       ;;
  162.   esac
  163.   $cmd "$@"
  164.   local ret=$?
  165.   if [ $ret -eq 0 ]; then
  166.     exit 0
  167.   else
  168.     echo "failed with code=$ret" >&2
  169.     exit $ret
  170.   fi
  171. }
  172.  
  173. function enquote_all () {
  174.   local ARG ARGS
  175.   ARGS=""
  176.   for ARG in "$@"; do
  177.     [ -n "$ARGS" ] && ARGS="$ARGS "
  178.     ARGS="$ARGS'""$( echo " $ARG" \
  179.                   | cut -c 2- \
  180.                   | sed 's/'"'"'/'"'"'"'"'"'"'"'"'/g' \
  181.                   )""'"
  182.   done
  183.   echo "$ARGS"
  184. }
  185.  
  186. ensure_dir () {
  187.   if ! [ -d "$1" ]; then
  188.     mkdir -p -- "$1" || fail "couldn't create $1"
  189.   fi
  190. }
  191.  
  192. remove_dir () {
  193.   if [ -d "$1" ]; then
  194.     rm -rf -- "$1" || fail "Could not remove $1"
  195.   fi
  196. }
  197.  
  198. fail () {
  199.   echo "$@" >&2
  200.   exit 1
  201. }
  202.  
  203. nave_fetch () {
  204.   local version=$(ver "$1")
  205.   if nave_has "$version"; then
  206.     echo "already fetched $version" >&2
  207.     return 0
  208.   fi
  209.  
  210.   local src="$NAVE_SRC/$version"
  211.   remove_dir "$src"
  212.   ensure_dir "$src"
  213.  
  214.   local url
  215.   local urls=(
  216.     "http://nodejs.org/dist/v$version/node-v$version.tar.gz"
  217.     "http://nodejs.org/dist/node-v$version.tar.gz"
  218.     "http://nodejs.org/dist/node-$version.tar.gz"
  219.   )
  220.   for url in "${urls[@]}"; do
  221.     get -#Lf "$url" > "$src".tgz
  222.     if [ $? -eq 0 ]; then
  223.       $tar xzf "$src".tgz -C "$src" --strip-components=1
  224.       if [ $? -eq 0 ]; then
  225.         echo "fetched from $url" >&2
  226.         return 0
  227.       fi
  228.     fi
  229.   done
  230.  
  231.   rm "$src".tgz
  232.   remove_dir "$src"
  233.   echo "Couldn't fetch $version" >&2
  234.   return 1
  235. }
  236.  
  237. get () {
  238.   curl -H "user-agent:nave/$(curl --version | head -n1)" "$@"
  239.   return $?
  240. }
  241.  
  242. build () {
  243.   local version="$1"
  244.  
  245.   # shortcut - try the binary if possible.
  246.   if [ -n "$os" ]; then
  247.     local binavail
  248.     # binaries started with node 0.8.6
  249.     case "$version" in
  250.       0.8.[012345]) binavail=0 ;;
  251.       0.[1234567]) binavail=0 ;;
  252.       *) binavail=1 ;;
  253.     esac
  254.     if [ $binavail -eq 1 ]; then
  255.       local t="$version-$os-$arch"
  256.       local url="http://nodejs.org/dist/v$version/node-v${t}.tar.gz"
  257.       local tgz="$NAVE_SRC/$t.tgz"
  258.       get -#Lf "$url" > "$tgz"
  259.       if [ $? -ne 0 ]; then
  260.         # binary download failed.  oh well.  cleanup, and proceed.
  261.         rm "$tgz"
  262.         echo "Binary download failed, trying source." >&2
  263.       else
  264.         # unpack straight into the build target.
  265.         $tar xzf "$tgz" -C "$2" --strip-components 1
  266.         if [ $? -ne 0 ]; then
  267.           rm "$tgz"
  268.           nave_uninstall "$version"
  269.           echo "Binary unpack failed, trying source." >&2
  270.         fi
  271.         # it worked!
  272.         echo "installed from binary" >&2
  273.         return 0
  274.       fi
  275.     fi
  276.   fi
  277.  
  278.   nave_fetch "$version"
  279.   if [ $? != 0 ]; then
  280.     # fetch failed, don't continue and try to build it.
  281.     return 1
  282.   fi
  283.  
  284.   local src="$NAVE_SRC/$version"
  285.   local jobs=$NAVE_JOBS
  286.   jobs=${jobs:-$JOBS}
  287.   jobs=${jobs:-$(sysctl -n hw.ncpu)}
  288.   jobs=${jobs:-2}
  289.  
  290.   ( cd -- "$src"
  291.     [ -f ~/.naverc ] && . ~/.naverc || true
  292.     if [ "$NAVE_CONFIG" == "" ]; then
  293.       NAVE_CONFIG=()
  294.     fi
  295.     JOBS=$jobs ./configure "${NAVE_CONFIG[@]}" --prefix="$2" \
  296.       || fail "Failed to configure $version"
  297.     JOBS=$jobs make -j$jobs \
  298.       || fail "Failed to make $version"
  299.     make install || fail "Failed to install $version"
  300.   ) || fail "fail"
  301.   return $?
  302. }
  303.  
  304. nave_usemain () {
  305.   if [ ${NAVELVL-0} -gt 0 ]; then
  306.     fail "Can't usemain inside a nave subshell. Exit to main shell."
  307.   fi
  308.   local version=$(ver "$1")
  309.   local current=$(node -v || true)
  310.   local wn=$(which node || true)
  311.   local prefix="/usr/local"
  312.   if [ "x$wn" != "x" ]; then
  313.     prefix="${wn/\/bin\/node/}"
  314.     if [ "x$prefix" == "x" ]; then
  315.       prefix="/usr/local"
  316.     fi
  317.   fi
  318.   current="${current/v/}"
  319.   if [ "$current" == "$version" ]; then
  320.     echo "$version already installed" >&2
  321.     return 0
  322.   fi
  323.  
  324.   build "$version" "$prefix"
  325. }
  326.  
  327. nave_install () {
  328.   local version=$(ver "$1")
  329.   if [ -z "$version" ]; then
  330.     fail "Must supply a version ('stable', 'latest' or numeric)"
  331.   fi
  332.   if nave_installed "$version"; then
  333.     echo "Already installed: $version" >&2
  334.     return 0
  335.   fi
  336.   local install="$NAVE_ROOT/$version"
  337.   ensure_dir "$install"
  338.  
  339.   build "$version" "$install"
  340.   local ret=$?
  341.   if [ $ret -ne 0 ]; then
  342.     remove_dir "$install"
  343.     return $ret
  344.   fi
  345. }
  346.  
  347. nave_test () {
  348.   local version=$(ver "$1")
  349.   nave_fetch "$version"
  350.   local src="$NAVE_SRC/$version"
  351.   ( cd -- "$src"
  352.     [ -f ~/.naverc ] && . ~/.naverc || true
  353.     if [ "$NAVE_CONFIG" == "" ]; then
  354.       NAVE_CONFIG=()
  355.     fi
  356.     ./configure "${NAVE_CONFIG[@]}" || fail "failed to ./configure"
  357.     make test-all || fail "Failed tests"
  358.   ) || fail "failed"
  359. }
  360.  
  361. nave_ls () {
  362.   ls -- $NAVE_SRC | version_list "src" \
  363.     && ls -- $NAVE_ROOT | version_list "installed" \
  364.     && nave_ls_named \
  365.     || return 1
  366. }
  367.  
  368. nave_ls_remote () {
  369.   get -s http://nodejs.org/dist/ \
  370.     | version_list "remote" \
  371.     || return 1
  372. }
  373.  
  374. nave_ls_named () {
  375.   echo "named:"
  376.   ls -- "$NAVE_ROOT" \
  377.     | egrep -v '[0-9]+\.[0-9]+\.[0-9]+' \
  378.     | sort \
  379.     | while read name; do
  380.       echo "$name: $(ver $($NAVE_ROOT/$name/bin/node -v 2>/dev/null))"
  381.     done
  382. }
  383.  
  384. nave_ls_all () {
  385.   nave_ls \
  386.     && (echo ""; nave_ls_remote) \
  387.     || return 1
  388. }
  389.  
  390. ver () {
  391.   local version="$1"
  392.   local nonames="$2"
  393.   version="${version/v/}"
  394.   case $version in
  395.     latest | stable) nave_$version ;;
  396.     +([0-9])\.+([0-9])) nave_version_family "$version" ;;
  397.     +([0-9])\.+([0-9])\.+([0-9])) echo $version ;;
  398.     *) [ "$nonames" = "" ] && echo $version ;;
  399.   esac
  400. }
  401.  
  402. nave_version_family () {
  403.   local family="$1"
  404.   family="${family/v/}"
  405.   get -s http://nodejs.org/dist/ \
  406.     | egrep -o $family'\.[0-9]+' \
  407.     | sort -u -k 1,1n -k 2,2n -k 3,3n -t . \
  408.     | tail -n1
  409. }
  410.  
  411. nave_latest () {
  412.   get -s http://nodejs.org/dist/ \
  413.     | egrep -o '[0-9]+\.[0-9]+\.[0-9]+' \
  414.     | sort -u -k 1,1n -k 2,2n -k 3,3n -t . \
  415.     | tail -n1
  416. }
  417.  
  418. nave_stable () {
  419.   get -s http://nodejs.org/dist/ \
  420.     | egrep -o '[0-9]+\.[0-9]*[02468]\.[0-9]+' \
  421.     | sort -u -k 1,1n -k 2,2n -k 3,3n -t . \
  422.     | tail -n1
  423. }
  424.  
  425. version_list_named () {
  426.   egrep -v '[0-9]+\.[0-9]+\.[0-9]+' \
  427.     | sort -u -k 1,1n -k 2,2n -k 3,3n -t . \
  428.     | organize_version_list \
  429.     || return 1
  430. }
  431.  
  432. version_list () {
  433.   echo "$1:"
  434.   egrep -o '[0-9]+\.[0-9]+\.[0-9]+' \
  435.     | sort -u -k 1,1n -k 2,2n -k 3,3n -t . \
  436.     | organize_version_list \
  437.     || return 1
  438. }
  439.  
  440. organize_version_list () {
  441.   local i=0
  442.   local v
  443.   while read v; do
  444.     if [ $i -eq 8 ]; then
  445.       i=0
  446.       echo "$v"
  447.     else
  448.       let 'i = i + 1'
  449.       echo -ne "$v\t"
  450.     fi
  451.   done
  452.   echo ""
  453.   [ $i -ne 0 ] && echo ""
  454.   return 0
  455. }
  456.  
  457. nave_has () {
  458.   local version=$(ver "$1")
  459.   [ -x "$NAVE_SRC/$version/configure" ] || return 1
  460. }
  461.  
  462. nave_installed () {
  463.   local version=$(ver "$1")
  464.   [ -x "$NAVE_ROOT/$version/bin/node" ] || return 1
  465. }
  466.  
  467. nave_use () {
  468.   local version=$(ver "$1")
  469.  
  470.   # if it's not a version number, then treat as a name.
  471.   case "$version" in
  472.     +([0-9])\.+([0-9])\.+([0-9])) ;;
  473.     *)
  474.       nave_named "$@"
  475.       return $?
  476.       ;;
  477.   esac
  478.  
  479.   if [ -z "$version" ]; then
  480.     fail "Must supply a version"
  481.   fi
  482.  
  483.   if [ "$version" == "$NAVENAME" ]; then
  484.     echo "already using $version" >&2
  485.     if [ $# -gt 1 ]; then
  486.       shift
  487.       "$@"
  488.     fi
  489.     return $?
  490.   fi
  491.  
  492.   nave_install "$version" || fail "failed to install $version"
  493.   local prefix="$NAVE_ROOT/$version"
  494.   local lvl=$[ ${NAVELVL-0} + 1 ]
  495.   echo "using $version" >&2
  496.   if [ $# -gt 1 ]; then
  497.     shift
  498.     nave_exec "$lvl" "$version" "$version" "$prefix" "$@"
  499.     return $?
  500.   else
  501.     nave_login "$lvl" "$version" "$version" "$prefix"
  502.     return $?
  503.   fi
  504. }
  505.  
  506. # internal
  507. nave_exec () {
  508.   nave_run "exec" "$@"
  509.   return $?
  510. }
  511.  
  512. nave_login () {
  513.   nave_run "login" "$@"
  514.   return $?
  515. }
  516.  
  517. nave_run () {
  518.   local exec="$1"
  519.   shift
  520.   local lvl="$1"
  521.   shift
  522.   local name="$1"
  523.   shift
  524.   local version="$1"
  525.   shift
  526.   local prefix="$1"
  527.   shift
  528.  
  529.   local bin="$prefix/bin"
  530.   local lib="$prefix/lib/node"
  531.   local man="$prefix/share/man"
  532.   ensure_dir "$bin"
  533.   ensure_dir "$lib"
  534.   ensure_dir "$man"
  535.  
  536.   # now $@ is the command to run, or empty if it's not an exec.
  537.   local exit_code
  538.   local args=()
  539.   local isLogin
  540.  
  541.   if [ "$exec" == "exec" ]; then
  542.     isLogin=""
  543.     # source the nave env file, then run the command.
  544.     args=("-c" ". $(enquote_all $NAVE_DIR/.zshenv); $(enquote_all "$@")")
  545.   elif [ "$shell" == "zsh" ]; then
  546.     isLogin="1"
  547.     # no need to set rcfile, since ZDOTDIR is set.
  548.     args=()
  549.   else
  550.     isLogin="1"
  551.     # bash, use --rcfile argument
  552.     args=("--rcfile" "$NAVE_DIR/.zshenv")
  553.   fi
  554.  
  555.   local nave="$version"
  556.   if [ "$version" != "$name" ]; then
  557.     nave="$name"-"$version"
  558.   fi
  559.  
  560.   NAVELVL=$lvl \
  561.   NAVEPATH="$bin" \
  562.   NAVEVERSION="$version" \
  563.   NAVENAME="$name" \
  564.   NAVE="$nave" \
  565.   npm_config_binroot="$bin"\
  566.   npm_config_root="$lib" \
  567.   npm_config_manroot="$man" \
  568.   npm_config_prefix="$prefix" \
  569.   NODE_PATH="$lib" \
  570.   NAVE_LOGIN="$isLogin" \
  571.   NAVE_DIR="$NAVE_DIR" \
  572.   ZDOTDIR="$NAVE_DIR" \
  573.     "$SHELL" "${args[@]}"
  574.  
  575.   exit_code=$?
  576.   hash -r
  577.   return $exit_code
  578. }
  579.  
  580. nave_named () {
  581.   local name="$1"
  582.   shift
  583.  
  584.   local version=$(ver "$1" NONAMES)
  585.   if [ "$version" != "" ]; then
  586.     shift
  587.   fi
  588.  
  589.   add_named_env "$name" "$version" || fail "failed to create $name env"
  590.  
  591.   if [ "$name" == "$NAVENAME" ] && [ "$version" == "$NAVEVERSION" ]; then
  592.     echo "already using $name" >&2
  593.     if [ $# -gt 0 ]; then
  594.       "$@"
  595.     fi
  596.     return $?
  597.   fi
  598.  
  599.   if [ "$version" = "" ]; then
  600.     version="$(ver "$("$NAVE_ROOT/$name/bin/node" -v 2>/dev/null)")"
  601.  fi
  602.  
  603.  local prefix="$NAVE_ROOT/$name"
  604.  
  605.  local lvl=$[ ${NAVELVL-0} + 1 ]
  606.  # get the version
  607.  if [ $# -gt 0 ]; then
  608.    nave_exec "$lvl" "$name" "$version" "$prefix" "$@"
  609.    return $?
  610.  else
  611.    nave_login "$lvl" "$name" "$version" "$prefix"
  612.    return $?
  613.  fi
  614. }
  615.  
  616. add_named_env () {
  617.  local name="$1"
  618.  local version="$2"
  619.  local cur="$(ver "$($NAVE_ROOT/$name/bin/node -v 2>/dev/null)" "NONAMES")"
  620.  
  621.  if [ "$version" != "" ]; then
  622.    version="$(ver "$version" "NONAMES")"
  623.  else
  624.    version="$cur"
  625.  fi
  626.  
  627.  if [ "$version" = "" ]; then
  628.    echo "What version of node?"
  629.    read -p "stable, latest, x.y, or x.y.z > " version
  630.    version=$(ver "$version")
  631.  fi
  632.  
  633.  # if that version is already there, then nothing to do.
  634.  if [ "$cur" = "$version" ]; then
  635.    return 0
  636.  fi
  637.  
  638.  echo "Creating new env named '$name' using node $version" >&2
  639.  
  640.  nave_install "$version" || fail "failed to install $version"
  641.  ensure_dir "$NAVE_ROOT/$name/bin"
  642.  ensure_dir "$NAVE_ROOT/$name/lib/node"
  643.  ensure_dir "$NAVE_ROOT/$name/lib/node_modules"
  644.  ensure_dir "$NAVE_ROOT/$name/share/man"
  645.  
  646.  ln -sf -- "$NAVE_ROOT/$version/bin/node" "$NAVE_ROOT/$name/bin/node"
  647.  ln -sf -- "$NAVE_ROOT/$version/bin/node-waf" "$NAVE_ROOT/$name/bin/node-waf"
  648. }
  649.  
  650. nave_clean () {
  651.  rm -rf "$NAVE_SRC/$(ver "$1")" "$NAVE_SRC/$(ver "$1")".tgz "$NAVE_SRC/$(ver "$1")"-*.tgz
  652. }
  653.  
  654. nave_uninstall () {
  655.  remove_dir "$NAVE_ROOT/$(ver "$1")"
  656. }
  657.  
  658. nave_help () {
  659.  cat <<EOF
  660.  
  661. Usage: nave <cmd>
  662.  
  663. Commands:
  664.  
  665. install <version>    Install the version passed (ex: 0.1.103)
  666. use <version>        Enter a subshell where <version> is being used
  667. use <ver> <program>  Enter a subshell, and run "<program>", then exit
  668. use <name> <ver>     Create a named env, using the specified version.
  669.                     If the name already exists, but the version differs,
  670.                     then it will update the link.
  671. usemain <version>    Install in /usr/local/bin (ie, use as your main nodejs)
  672. clean <version>      Delete the source code for <version>
  673. uninstall <version>  Delete the install for <version>
  674. ls                   List versions currently installed
  675. ls-remote            List remote node versions
  676. ls-all               List remote and local node versions
  677. latest               Show the most recent dist version
  678. help                 Output help information
  679.  
  680. <version> can be the string "latest" to get the latest distribution.
  681. <version> can be the string "stable" to get the latest stable version.
  682.  
  683. EOF
  684. }
  685.  
  686. main "$@"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement