From b083ef832feab6b311c482b14cfe65be08c0020c Mon Sep 17 00:00:00 2001 From: Rocky Assad Date: Wed, 10 May 2017 13:04:40 -0500 Subject: [PATCH] uses the ./jq parser to show node specific info --- plugins/jq-node/README.md | 24 ++++++++++++++++++++++ plugins/jq-node/package-version.plugin.zsh | 15 ++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 plugins/jq-node/README.md create mode 100644 plugins/jq-node/package-version.plugin.zsh diff --git a/plugins/jq-node/README.md b/plugins/jq-node/README.md new file mode 100644 index 00000000..bd486518 --- /dev/null +++ b/plugins/jq-node/README.md @@ -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` \ No newline at end of file diff --git a/plugins/jq-node/package-version.plugin.zsh b/plugins/jq-node/package-version.plugin.zsh new file mode 100644 index 00000000..bc9d9610 --- /dev/null +++ b/plugins/jq-node/package-version.plugin.zsh @@ -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 +} \ No newline at end of file