b 4 hónapja
szülő
commit
1d13241362
1 módosított fájl, 3 hozzáadás és 1 törlés
  1. 3 1
      tool-trunk-checker.sh

+ 3 - 1
tool-trunk-checker.sh

@@ -36,6 +36,7 @@ while [[ $# -gt 0 ]]; do
 		shift
 		shift
 		;;
 		;;
 	-f | --file)
 	-f | --file)
+		MODE="file"
 		if [ -f "$2" ]; then
 		if [ -f "$2" ]; then
 			USER_FILES_ARRAY+=("$2")
 			USER_FILES_ARRAY+=("$2")
 		else
 		else
@@ -44,6 +45,7 @@ while [[ $# -gt 0 ]]; do
 		shift 2
 		shift 2
 		;;
 		;;
 	-d | --dir)
 	-d | --dir)
+		MODE="dir"
 		if [ -d "$2" ]; then
 		if [ -d "$2" ]; then
 			# 查找目录下的所有文件并添加到数组
 			# 查找目录下的所有文件并添加到数组
 			while IFS= read -r file; do
 			while IFS= read -r file; do
@@ -65,6 +67,7 @@ while [[ $# -gt 0 ]]; do
 		;;
 		;;
 	*)
 	*)
 		# 处理直接指定的文件或目录
 		# 处理直接指定的文件或目录
+		MODE="处理直接指定的文件或目录"
 		if [ -f "$1" ]; then
 		if [ -f "$1" ]; then
 			USER_FILES_ARRAY+=("$1")
 			USER_FILES_ARRAY+=("$1")
 		elif [ -d "$1" ]; then
 		elif [ -d "$1" ]; then
@@ -145,7 +148,6 @@ else
 		ALL_FILES=""
 		ALL_FILES=""
 	fi
 	fi
 fi
 fi
-echo "1:${ALL_FILES}"
 
 
 # 去重并过滤空行和隐藏文件(仅在all模式下过滤隐藏文件)
 # 去重并过滤空行和隐藏文件(仅在all模式下过滤隐藏文件)
 if [ "${MODE}" = "all" ] || [ -n "${USER_FILES}" ]; then
 if [ "${MODE}" = "all" ] || [ -n "${USER_FILES}" ]; then