Browse Source

add linux script

liuyuqi-dellpc 3 weeks ago
parent
commit
d4013bdc9f
1 changed files with 49 additions and 0 deletions
  1. 49 0
      scripts/start_auto_commit.sh

+ 49 - 0
scripts/start_auto_commit.sh

@@ -0,0 +1,49 @@
+#!/bin/bash
+# @Contact :   liuyuqi.gov@msn.cn
+# @Time    :   2025/02/14 10:29:54
+# @License :   (C)Copyright 2022 liuyuqi.
+# @Desc    :   muti auto commit 
+###############################################################################
+curpath=$(cd "$(dirname "$0")" && pwd)
+
+echo "当前项目目录:$curpath"
+
+if [ -d "$curpath/.git" ]; then
+    mv "$curpath/.git" "$curpath/.git2"
+fi
+
+while true; do
+    echo "请输入要执行的操作(输入1,2,3) 或 输入q退出:"
+    echo "1. 执行 commit 命令"
+    echo "2. 执行 sync 命令"
+    echo "3. 执行 check 命令"
+
+    read -r option
+    
+    case $option in
+        1)
+            echo "执行 commit 命令: sh dist/auto_commit commit --path "$curpath""
+            ./dist/auto_commit commit --path "$curpath"
+            ;;
+        2)
+            echo "执行 sync 命令"
+            ./dist/auto_commit sync --path "$curpath"
+            ;;
+        3)
+            echo "执行 check 命令"
+            ./dist/auto_commit check --path "$curpath"
+            ;;
+        q)
+            echo "退出程序"
+            break
+            ;;
+        *)
+            echo "无效的选项"
+            ;;
+    esac
+done
+
+if [ -d "$curpath/.git2" ]; then
+    mv "$curpath/.git2" "$curpath/.git"
+fi
+