@@ -96,11 +96,15 @@ local function split(str, sep)
9696 return t
9797end
9898
99+ --- @class dummyfs
100+ --- @operator div (string | fs.path | dummyfs ): dummyfs
101+ --- @field files table
99102local dfs = {}
100103dfs .__index = dfs
101104dfs .type = ' dummy'
102105dfs .path = ' '
103106
107+ --- @return dummyfs
104108function m .dummyFS (t )
105109 return setmetatable ({
106110 files = t or {},
@@ -257,7 +261,7 @@ function dfs:saveFile(path, text)
257261 return true
258262end
259263
260- --- @param path string | fs.path
264+ --- @param path string | fs.path | dummyfs
261265--- @param option table
262266--- @return fs.path ?
263267local function fsAbsolute (path , option )
@@ -449,7 +453,7 @@ local function fileRemove(path, option)
449453 end
450454end
451455
452- --- @param source fs.path ?
456+ --- @param source fs.path | dummyfs ?
453457--- @param target fs.path ?
454458--- @param option table
455459local function fileCopy (source , target , option )
@@ -485,7 +489,7 @@ local function fileCopy(source, target, option)
485489 end
486490end
487491
488- --- @param source fs.path ?
492+ --- @param source fs.path | dummyfs ?
489493--- @param target fs.path ?
490494--- @param option table
491495local function fileSync (source , target , option )
@@ -594,8 +598,8 @@ function m.fileRemove(path, option)
594598end
595599
596600--- 复制文件(夹)
597- --- @param source string | fs.path
598- --- @param target string | fs.path
601+ --- @param source string | fs.path | dummyfs
602+ --- @param target string | fs.path | dummyfs
599603--- @return table
600604function m .fileCopy (source , target , option )
601605 option = buildOption (option )
@@ -608,8 +612,8 @@ function m.fileCopy(source, target, option)
608612end
609613
610614--- 同步文件(夹)
611- --- @param source string | fs.path
612- --- @param target string | fs.path
615+ --- @param source string | fs.path | dummyfs
616+ --- @param target string | fs.path | dummyfs
613617--- @return table
614618function m .fileSync (source , target , option )
615619 option = buildOption (option )
0 commit comments