mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-08 04:34:00 +02:00
uses the ./jq parser to show node specific info
This commit is contained in:
parent
291e96dcd0
commit
b083ef832f
2 changed files with 39 additions and 0 deletions
24
plugins/jq-node/README.md
Normal file
24
plugins/jq-node/README.md
Normal file
|
|
@ -0,0 +1,24 @@
|
||||||
|
## uses ./jq to show node specific info
|
||||||
|
|
||||||
|
# pre-requisite
|
||||||
|
|
||||||
|
install ./jq
|
||||||
|
|
||||||
|
download
|
||||||
|
> https://stedolan.github.io/jq/
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
> `brew install jq`
|
||||||
|
|
||||||
|
# API
|
||||||
|
|
||||||
|
### Show node project version
|
||||||
|
|
||||||
|
While inside the root of a node project (containing a package.json file) type:
|
||||||
|
|
||||||
|
`> pv`
|
||||||
|
|
||||||
|
Displays the project version
|
||||||
|
|
||||||
|
`v8.0.1`
|
||||||
15
plugins/jq-node/package-version.plugin.zsh
Normal file
15
plugins/jq-node/package-version.plugin.zsh
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
# package-version.plugin.zsh
|
||||||
|
# Shows the version of the package.json file in current directory
|
||||||
|
package_version() {
|
||||||
|
if [[ -f ./package.json ]]
|
||||||
|
then
|
||||||
|
echo "v$(jq -r .version package.json)"
|
||||||
|
else
|
||||||
|
echo "no package.json file found"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# shorts
|
||||||
|
pv() {
|
||||||
|
package_version
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue