# # npm-i (https://gist.github.com/martinheidegger/5217df563c8e1edcacbd) # Helper to make installing a package in node-js more comfortable. # npm-i() { if [[ -z "$1" ]]; then echo "Usage: npm-i (var)" else npm install $1 --save if [[ "$2" == "var" ]]; then stmt="var $1 = require(\"$1\");" else stmt="require(\"$1\");" fi echo "Adding '$stmt' to clipboard." echo "$stmt" | pbcopy fi }