From 915a560b4309adf0aa201a011f972121196e6b02 Mon Sep 17 00:00:00 2001 From: YoumuLiu Date: Mon, 22 Apr 2024 02:50:49 +0800 Subject: [PATCH] =?UTF-8?q?daily=20update=20on=2020240422=20by=20nitload?= =?UTF-8?q?=20youmu,=20auto=20=1B[D=1B[D=1B[D=1B[D=1B[D=1B[D=1B[C=1B[C=1B[?= =?UTF-8?q?C=1B[C=1B[C=1B[Caync=20script=20improve?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autoadd.sh | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 autoadd.sh diff --git a/autoadd.sh b/autoadd.sh new file mode 100644 index 00000000..0a1e433b --- /dev/null +++ b/autoadd.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +clear + +# 设置要查找的文件类型 +file_types=( "*.cs" "*.c" "*.cpp" "*.h" "*.txt" "*.csproj" "*.vs" "*.vert" "*.frag" "*.sln" "*.vcxproj" "*.json" "*.sh" ) + +# 循环遍历每个文件类型,并添加到git +for type in "${file_types[@]}"; do + # 执行find命令,并将输出保存到变量中 + add_output=$(find . -name "$type" -exec git add '{}' + 2>&1) + add_status=$? + + # 检查find命令的退出状态 + if [ $add_status -ne 0 ]; then + # 如果出错,显示保存的输出 + echo "$add_output" + exit 1 + fi +done +clear + +# 提示用户输入commit信息 +echo "====================== file added ======================" +echo "请输入commit信息:" +read commit_message + +# 执行git commit命令,并将输出保存到变量中 +commit_output=$(git commit -m "$commit_message" 2>&1) +commit_status=$? + +# 检查git commit命令的退出状态 +if [ $commit_status -ne 0 ]; then + # 如果出错,显示保存的输出 + echo "$commit_output" + exit 1 +fi + +clear + +echo "" +echo "================ successfully committed =================" +echo "" +# 执行git push命令 +git push CCD_Git local:main +git push CCD_Git local:nitload + +if [ $? -ne 0 ]; then + exit 1 +fi + +clear +exit \ No newline at end of file