Last active
April 16, 2019 01:59
-
-
Save musicq/6ab11d6900a012761faef03073efab91 to your computer and use it in GitHub Desktop.
J-CLI Manager
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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