diff options
| author | ruki <[email protected]> | 2022-07-23 11:50:39 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2022-07-23 11:50:39 +0800 |
| commit | 1b956a7bb9c6dcdc0c0baff2f2a4f57134a3a2a3 (patch) | |
| tree | effcf2f36d7367e21a38c2f4b61115576b7ec070 | |
| parent | 9d575f566d326a83137d48fe2e277b2d95cca235 (diff) | |
improve events
| -rw-r--r-- | xmake/plugins/watch/main.lua | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/xmake/plugins/watch/main.lua b/xmake/plugins/watch/main.lua index 7dd30d66d..eb5f3df55 100644 --- a/xmake/plugins/watch/main.lua +++ b/xmake/plugins/watch/main.lua @@ -70,7 +70,15 @@ function _run_command() script() elseif os.isfile(os.projectfile()) then local argv = {"build"} - table.insert(argv, "-w") + if option.get("verbose") then + table.insert(argv, "-v") + end + if option.get("diagnosis") then + table.insert(argv, "-D") + end + if option.get("warning") then + table.insert(argv, "-w") + end local target = option.get("target") if target then table.insert(argv, target) @@ -93,10 +101,10 @@ function main() _add_watchdirs() -- do watch + local count = 0 while true do - local ok, event = fwatcher.wait(-1) + local ok, event = fwatcher.wait(300) if ok > 0 then - -- trace event local status if event.type == fwatcher.ET_CREATE then status = "created" @@ -106,9 +114,10 @@ function main() status = "deleted" end print(event.path, status) - - -- run command + count = count + 1 + elseif count > 0 then _run_command() + count = 0 end end end |
