diff options
| author | ruki <[email protected]> | 2025-11-20 12:29:42 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-11-20 12:29:42 +0800 |
| commit | 6046c050650e63b430777dda1c6ce497ac43917e (patch) | |
| tree | c87babf08377b31f2ddf87b4e79cb34312927b83 /xmake/plugins/format/main.lua | |
| parent | 867cac26f83933451ab21ea94c6d2ddded373992 (diff) | |
| parent | 800e4177ac9584c30a56bf1c3ce356b76b6653e8 (diff) | |
Merge pull request #7040 from xmake-io/progress
Improve multi-row progress
Diffstat (limited to 'xmake/plugins/format/main.lua')
| -rw-r--r-- | xmake/plugins/format/main.lua | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/xmake/plugins/format/main.lua b/xmake/plugins/format/main.lua index aa2814af8..7a4c53394 100644 --- a/xmake/plugins/format/main.lua +++ b/xmake/plugins/format/main.lua @@ -216,12 +216,25 @@ function main() jobs = os.default_njob() end local format_time = os.mclock() + local runjobs_opt = { + total = #sourcefiles, + comax = jobs, + showtips = false + } + -- Only set timer for multirow progress mode + if progress.is_multirow() then + runjobs_opt.timeout = 1000 + runjobs_opt.on_timer = function (running_indices) + -- Periodically refresh multirow progress to update elapsed time + progress.refresh() + end + end runjobs("clang-format", function (index, total, opt) local sourcefile = sourcefiles[index] local format_argv = table.join(argv, {sourcefile}) - progress.show(index * 100 / total, "clang-format.formatting %s", sourcefile) + progress.show(opt.progress, "clang-format.formatting %s", sourcefile) os.execv(clang_format.program, format_argv, {curdir = projectdir}) - end, {total = #sourcefiles, comax = jobs}) + end, runjobs_opt) format_time = os.mclock() - format_time progress.show(100, "${color.success}clang-format formatted %d files, spent %.3fs", #sourcefiles, format_time / 1000) end |
