Skip to content

Instantly share code, notes, and snippets.

@musicq
Last active April 16, 2019 01:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save musicq/6ab11d6900a012761faef03073efab91 to your computer and use it in GitHub Desktop.
Save musicq/6ab11d6900a012761faef03073efab91 to your computer and use it in GitHub Desktop.
J-CLI Manager
#!/usr/bin/env bash
command=$1
registry="https://registry-npm.yunzhanghu.net"
if [ ! ${command} ]; then
command="install"
fi
function setNpmRegistry() {
yarn config set @yzh:registry ${registry}
yarn config set @yzh-devkit:registry ${registry}
}
function install() {
yarn global add @yzh/j-cli
# clear the screen
clear
echo
echo "--------------------------------------------------------------"
echo "| 🎉 J-CLI has been installed successfully! |"
echo "| |"
echo "| Try to type command 'j' in your terminal to see the usage. |"
echo "--------------------------------------------------------------"
echo
}
function uninstall() {
echo "Are you sure to uninstall J-CLI from your computer? [y/n]"
read ans
# default is y
if [ ! ${ans} ]; then
ans='y'
fi
if [ ${ans} == "y" ]; then
yarn global remove @yzh/j-cli
echo "J-CLI has been removed."
elif [ ${ans} == "n" ]; then
return
else
echo "Please enter y or n"
return
fi
}
setNpmRegistry
if [ ${command} == "install" ]; then
install
elif [ ${command} == "uninstall" ]; then
uninstall
fi
@musicq
Copy link
Author

musicq commented Mar 14, 2019

Install J-CLI

curl -fsSL https://gist.githubusercontent.com/musicq/6ab11d6900a012761faef03073efab91/raw/79e49801ada6d32fa047c5e212fa138d59b719e5/install.sh | bash

Uninstall J-CLI

curl -fsSL https://gist.githubusercontent.com/musicq/6ab11d6900a012761faef03073efab91/raw/79e49801ada6d32fa047c5e212fa138d59b719e5/install.sh | bash -s uninstall

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment