1
0
mirror of https://github.com/NevermindZZT/letter-shell.git synced 2025-01-21 10:02:54 +08:00

更新 命令遍历工具

This commit is contained in:
Letter 2021-07-11 21:05:25 +08:00
parent a34f08ab6f
commit d38da07c42

View File

@ -18,8 +18,8 @@ import os
import sys import sys
import re import re
FILE_PATTERN = r"^.*?\.(c|h)$" FILE_PATTERN = r"^.*?\.(cpp|c|h)$"
SHELL_EXPORT_PATTERN = r"^\s*SHELL_EXPORT_(CMD|CMD_AGENCY|VAR|USER|KEY|KEY_AGENCY|CMD_GROUP)\s*\(\s*\S+\s*,\s*(\S+)\s*,.*$" SHELL_EXPORT_PATTERN = r"^\s*SHELL_EXPORT_(CMD|CMD_AGENCY|VAR|USER|KEY|KEY_AGENCY|CMD_GROUP|PASSTROUGH)\s*\(\s*\S+\s*,\s*(\S+)\s*,.*$"
def isCodeFile(name): def isCodeFile(name):
return re.match(FILE_PATTERN, name) != None return re.match(FILE_PATTERN, name) != None
@ -28,7 +28,7 @@ def getCodeFiles(path):
names = os.listdir(path) names = os.listdir(path)
files = [] files = []
for name in names: for name in names:
fullName = path + '\\' + name fullName = os.path.join(path, name)
if os.path.isdir(fullName): if os.path.isdir(fullName):
files = files + getCodeFiles(fullName) files = files + getCodeFiles(fullName)
else: else:
@ -80,5 +80,5 @@ if __name__ == "__main__":
pass pass
for item in sorted(itemList, key=lambda x:(x[1])): for item in sorted(itemList, key=lambda x:(x[1])):
print("shell export %s, %s in file %s(%d)" print("shell export %s, %s in file %s:%d"
%(item[0], item[1], item[2], item[3])) %(item[0], item[1], item[2], item[3]))