mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-26 02:12:33 +01:00
Added support in node-docs for versions like -pre and -rc. Accounts for the dash.
This commit is contained in:
parent
762b55bb2b
commit
6231dbbd26
1 changed files with 8 additions and 1 deletions
|
|
@ -1,5 +1,12 @@
|
|||
# Open the node api for your current version to the optional section.
|
||||
# TODO: Make the section part easier to use.
|
||||
function node-docs {
|
||||
open "http://nodejs.org/docs/$(node --version)/api/all.html#$1"
|
||||
nodeversion=`node --version`
|
||||
dashlocation=`echo $nodeversion | sed -n "s/-.*//p" | wc -c`;
|
||||
|
||||
if [[ $dashlocation -eq 0 ]]; then
|
||||
open "http://nodejs.org/docs/${nodeversion}/api/all.html#$1";
|
||||
else
|
||||
open "http://nodejs.org/docs/${nodeversion:0:$dashlocation - 1}/api/all.html#$1";
|
||||
fi
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue