diff --git a/dist/copyt.exe b/dist/copyt.exe index 3784e0a..3489627 100644 Binary files a/dist/copyt.exe and b/dist/copyt.exe differ diff --git a/dist/copyt.zip b/dist/copyt.zip index 0d44c95..97833f4 100644 Binary files a/dist/copyt.zip and b/dist/copyt.zip differ diff --git a/dist/res/index.js b/dist/res/index.js index 340556c..0f23cea 100644 --- a/dist/res/index.js +++ b/dist/res/index.js @@ -8,14 +8,20 @@ const dir = process.argv[2]; // const dir = 'E:\\data\\web\\vue.js\\vue3\\hir'; // 文件类型过滤 -const filterArg = process.argv[3]; +let filterArg = process.argv[3]; // const filterArg = '\\.js|\\.vue'; +if (filterArg==="*") { + filterArg = '.+'; +} const filter = new RegExp("("+filterArg+")$",'i'); // 文件夹过滤 const excludeArg = process.argv[4]; // const excludeArg = 'node_modules|dist'; -const exclude = new RegExp(excludeArg,'i'); +let exclude; +if (excludeArg!=='*') { + exclude = new RegExp(excludeArg,'i'); +} const codeFilePath = process.argv[5]; // const codeFilePath = './code.txt'; @@ -33,11 +39,14 @@ let api = new fdir().withFullPaths().filter( // 文件类型过滤, true 则包含 return filter.test(path); } -).exclude((dirName, dirPath) =>{ - // console.log(dirName); - return exclude.test(dirName); +) +if (exclude) { + api = api.exclude((dirName="", dirPath) =>{ + // console.log(dirName); + return exclude.test(dirName); + } + ); } -); api.crawl(dir).withPromise().then((files) => { for (let index = 0; index < files.length; index++) { diff --git a/main.aardio b/main.aardio index ab45ac8..969a0f8 100644 --- a/main.aardio +++ b/main.aardio @@ -6,13 +6,14 @@ button={cls="button";text="开始整理";left=512;top=144;right=584;bottom=176;d button2={cls="button";text="停止整理";left=584;top=144;right=656;bottom=176;db=0.55;disabled=1;dr=1;z=1}; button3={cls="button";text="选择";left=64;top=96;right=104;bottom=112;ah=1;dl=1;font=LOGFONT(h=-9);z=12}; button4={cls="button";text="选择";left=64;top=152;right=104;bottom=168;ah=1;dl=1;font=LOGFONT(h=-9);z=13}; +checkbox={cls="checkbox";text="过滤文件夹";left=232;top=8;right=320;bottom=24;checked=1;z=15}; codeFilePath={cls="edit";left=112;top=128;right=472;bottom=176;ah=1;autovscroll=false;dl=1;edge=1;hscroll=1;multiline=1;z=10}; dir={cls="edit";left=112;top=72;right=472;bottom=120;ah=1;autovscroll=false;dl=1;edge=1;hscroll=1;multiline=1;z=8}; -excludeDir={cls="edit";text="node_modules|dist";left=304;top=8;right=472;bottom=56;ah=1;autohscroll=false;dl=1;edge=1;multiline=1;vscroll=1;z=6}; +excludeDir={cls="edit";text="node_modules|dist";left=320;top=8;right=472;bottom=56;ah=1;autohscroll=false;dl=1;edge=1;multiline=1;vscroll=1;z=6}; fileType={cls="edit";text=".js|.vue|.jsx|.mjs|.ts";left=72;top=8;right=216;bottom=56;ah=1;autohscroll=false;dl=1;edge=1;multiline=1;vscroll=1;z=4}; richedit={cls="richedit";left=8;top=184;right=656;bottom=384;autohscroll=false;db=1;dl=1;dr=1;dt=0.47;edge=1;multiline=1;vscroll=1;z=14}; static={cls="static";text="文件类型";left=16;top=8;right=72;bottom=24;ah=1;dl=1;transparent=1;z=3}; -static2={cls="static";text="过滤文件夹";left=232;top=8;right=304;bottom=24;ah=1;dl=1;transparent=1;z=5}; +static2={cls="static";left=232;top=8;right=304;bottom=24;ah=1;dl=1;transparent=1;z=5}; static3={cls="static";text="欲处理项目路径";left=16;top=72;right=112;bottom=88;ah=1;dl=1;transparent=1;z=7}; static4={cls="static";text="汇总代码存放 路径";left=16;top=128;right=104;bottom=168;ah=1;dl=1;transparent=1;z=9}; @@ -34,8 +35,14 @@ mainForm.button.oncommand = function(id,event){ mainForm.button2.disabled=false; var js = string.load("\res\index.js"); - - prcs = nodeJs.exec(js,mainForm.dir.text,mainForm.fileType.text,mainForm.excludeDir.text,mainForm.codeFilePath.text); + if(mainForm.fileType.text==""){ + mainForm.fileType.text="*"; + } + var excludeDir=mainForm.excludeDir.text; + if(excludeDir==""){ + excludeDir="*"; + } + prcs = nodeJs.exec(js,mainForm.dir.text,mainForm.fileType.text,excludeDir,mainForm.codeFilePath.text); prcs.logResponse(function(v){ mainForm.richedit.log(v); @@ -57,16 +64,32 @@ mainForm.button2.oncommand = function(id,event){ mainForm.button3.oncommand = function(id,event){ - mainForm.dir.text = fsys.dlg.dir(); + var dir = fsys.dlg.dir(); + if(dir){ + mainForm.dir.text = dir; + } } mainForm.button4.oncommand = function(id,event){ - mainForm.codeFilePath.text = fsys.dlg.dir()++"\code.txt"; + var dir = fsys.dlg.dir(); + if(dir){ + mainForm.codeFilePath.text = dir++"\code.txt"; + } } mainForm.onClose = function(hwnd,message,wParam,lParam){ mainForm.button2.oncommand(); } +mainForm.checkbox.oncommand = function(id,event){ + if(!mainForm.checkbox.checked){ + mainForm.excludeDir.disabled = true; + mainForm.excludeDir.text=""; + }else { + mainForm.excludeDir.disabled = false; + } + +} + mainForm.show(); return win.loopMessage(); \ No newline at end of file diff --git a/res/index.js b/res/index.js index 340556c..0f23cea 100644 --- a/res/index.js +++ b/res/index.js @@ -8,14 +8,20 @@ const dir = process.argv[2]; // const dir = 'E:\\data\\web\\vue.js\\vue3\\hir'; // 文件类型过滤 -const filterArg = process.argv[3]; +let filterArg = process.argv[3]; // const filterArg = '\\.js|\\.vue'; +if (filterArg==="*") { + filterArg = '.+'; +} const filter = new RegExp("("+filterArg+")$",'i'); // 文件夹过滤 const excludeArg = process.argv[4]; // const excludeArg = 'node_modules|dist'; -const exclude = new RegExp(excludeArg,'i'); +let exclude; +if (excludeArg!=='*') { + exclude = new RegExp(excludeArg,'i'); +} const codeFilePath = process.argv[5]; // const codeFilePath = './code.txt'; @@ -33,11 +39,14 @@ let api = new fdir().withFullPaths().filter( // 文件类型过滤, true 则包含 return filter.test(path); } -).exclude((dirName, dirPath) =>{ - // console.log(dirName); - return exclude.test(dirName); +) +if (exclude) { + api = api.exclude((dirName="", dirPath) =>{ + // console.log(dirName); + return exclude.test(dirName); + } + ); } -); api.crawl(dir).withPromise().then((files) => { for (let index = 0; index < files.length; index++) {