From 607ba19e57fd3ef39a65417b8f0370a354e560f4 Mon Sep 17 00:00:00 2001 From: amy Date: Tue, 28 Feb 2023 13:59:52 +0000 Subject: lots of things i think --- src/jssh.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'src/jssh.js') diff --git a/src/jssh.js b/src/jssh.js index 7035ce3..ee3eb6d 100644 --- a/src/jssh.js +++ b/src/jssh.js @@ -7,6 +7,22 @@ class jssh { this.uid = uid; this.window_create = window_create; } + search(fs,target,opt={},path='./'){ + let match = [] + for(let f of fs){ + if(f.dir){ + let tt = this.search(f.content,target,opt,path+f.name+"/") + if(tt!=undefined&&tt.length>0) + match.push(...tt) + } + if((!opt.exact&&hrx(f.name,"*"+target+"*")||(opt.exact&&hrx(f.name,target)))){ + match.push(path+f.name) + } + } + //console.log(match.length) + //if(match.length!=0) + return match; + } set_wd(dir) { //let lwd = fs let wd = fs; -- cgit v1.2.3