Skip to content

Commit

Permalink
feat: update install
Browse files Browse the repository at this point in the history
  • Loading branch information
WGrape committed Feb 28, 2024
1 parent d95b13e commit cb6c545
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ posture是一个轻量可扩展的开发姿势监督与矫正工具,让您快
您可以先通过以下命令完成下载安装操作,如果出现```install successfully```提示,则说明安装成功。

```bash
git clone https://github.com/WGrape/posture.git && cd posture && bash ./install.sh
git clone https://github.com/WGrape/posture.git && cd posture && bash ./install.sh && posture
```

<details>
Expand Down
10 changes: 8 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@
chmod a+x ./posture
chmod a+x ./uninstall.sh
currentDir=$(pwd)

if grep -qF 'export POSTUREPATH=' ~/.bash_profile; then
echo "please clear installed data of posture in your ~/.bash_profile"
exit 1
fi

echo "# Here is the configurations of posture" >> ~/.bash_profile
echo "export POSTUREPATH=${currentDir}" >> ~/.bash_profile
echo "export PATH=\$PATH:${POSTUREPATH}" >> ~/.bash_profile
source ~/.bash_profile
echo "export PATH=\$PATH:\$POSTUREPATH" >> ~/.bash_profile
source ~/.bash_profile &> /dev/null
echo "install successfully"
20 changes: 11 additions & 9 deletions posture
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
if [ "${POSTUREPATH}" == "" ]; then
echo "缺少POSTUREPATH配置 (You missed the configuration of POSTUREPATH)"
echo "You missed the configuration of POSTUREPATH"
exit 1
fi
. $POSTUREPATH/include/function.sh
Expand All @@ -16,13 +16,15 @@ elif [ "${COMMAND}" == "info" ]; then
showInfo
elif [ "${COMMAND}" == "update" ]; then
updateVersion
elif [ "${COMMAND}" == "help" ]; then
echo "下面是posture支持的命令列表 (Here is support commands)"
echo " sethook: 设置全局钩子 (set the global git hooks)"
echo " adjust: 调整代码规范 (adjust the code specification)"
echo " update: 更新至最新版本 (update to latest version)"
echo " info: 展示posture配置的相关信息 (show the information of posture)"
echo " help: 查看帮助 (view help)"
elif [ "${COMMAND}" == "help" ] || [ "${COMMAND}" == "" ]; then
printLogo

echo "Here is support commands"
echo " sethook: set the global git hooks"
echo " adjust: adjust the code specification"
echo " update: update to latest version"
echo " info: show the information of posture"
echo " help: view help"
else
echo "不支持的命令: ${COMMAND} (Unknown command: ${COMMAND})"
echo "Unknown command: ${COMMAND}"
fi

0 comments on commit cb6c545

Please sign in to comment.