可以参考之前更改commit
的逻辑。不过要注意,如果设置了全局 hooks , 项目内的就无法使用了
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| #!/bin/sh
REPO_NAME=$(git remote get-url origin | xargs basename -s .git) echo "Repository Name: $REPO_NAME"
panshi_pre() { cd "$(git rev-parse --show-toplevel)" || { echo "Failed to change to toplevel directory"; exit 1; } /Users/thh/go/bin/kuai tool:build_catalogue > catalogue.md 2>&1 if [ ! -s catalogue.md ]; then echo "文件没有生成检查是否正常" exit 0 fi git add catalogue.md echo "目录生成" }
if [[ "$REPO_NAME" == *"panshi-doc"* ]]; then panshi_pre exit 0 else echo "不需要生成目录" exit 0 fi
|