Browse Source

Merge branch 'release/0.7.0'

liuyuqi-dellpc 1 month ago
parent
commit
d4d2b57a7c
2 changed files with 58 additions and 4 deletions
  1. 9 4
      auto_commit/auto_commit.py
  2. 49 0
      scripts/start_auto_commit.sh

+ 9 - 4
auto_commit/auto_commit.py

@@ -6,6 +6,7 @@
 @License :   Copyright © 2017-2022 liuyuqi. All Rights Reserved.
 @Desc    :   auto commit
 """
+from curses import window
 import os
 from auto_commit.utils.colors import bcolors
 
@@ -55,8 +56,10 @@ class AutoCommit(object):
             for root, dirs, files in os.walk(self.params['path']):
                 if ".git" in dirs:
                     self._check(root)
-        os.system("pause")
-
+        if os.name == "nt":
+            os.system("pause")         # linux without this comoand
+        # else:  # Linux or other Unix-like systems
+        #     os.system("read -n 1 -s -r -p 'Press any key to continue...'")
 
     def commit(self):
         """ run """
@@ -66,7 +69,8 @@ class AutoCommit(object):
             for root, dirs, files in os.walk(self.params['path']):
                 if ".git" in dirs:
                     self._commit(root)
-        os.system("pause")
+        if os.name == "nt":
+            os.system("pause")
     
     def sync(self):
         """ sync """
@@ -76,4 +80,5 @@ class AutoCommit(object):
             for root, dirs, files in os.walk(self.params['path']):
                 if ".git" in dirs:
                     self._sync(root)
-        os.system("pause")
+        if os.name == "nt":
+            os.system("pause")

+ 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
+