summaryrefslogtreecommitdiff
path: root/xmake/modules/private/utils/progress.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2020-05-31 10:31:59 +0800
committerruki <[email protected]>2020-05-31 10:31:59 +0800
commit6d67b96bf3977f9f9376e03195933638e75f92ba (patch)
treeb77a0db55b27c090a5e4a61eb86f7a9f6bc590e4 /xmake/modules/private/utils/progress.lua
parentaab3a9a8bf7c07cbf80d62c7bc5bc11c8cbf6fd3 (diff)
add ninja theme
Diffstat (limited to 'xmake/modules/private/utils/progress.lua')
-rw-r--r--xmake/modules/private/utils/progress.lua24
1 files changed, 23 insertions, 1 deletions
diff --git a/xmake/modules/private/utils/progress.lua b/xmake/modules/private/utils/progress.lua
index ad1402238..dbcc69a55 100644
--- a/xmake/modules/private/utils/progress.lua
+++ b/xmake/modules/private/utils/progress.lua
@@ -89,13 +89,35 @@ function process:running()
return self._RUNNING and true or false
end
+-- showing progress line without scroll?
+function showing_without_scroll()
+ return _g.showing_without_scroll
+end
+
-- show the message with process
function show(progress, format, ...)
local progress_prefix = "${color.build.progress}" .. theme.get("text.build.progress_format") .. ":${clear} "
if option.get("verbose") then
cprint(progress_prefix .. "${dim}" .. format, progress, ...)
else
- cprint(progress_prefix .. format, progress, ...)
+ local is_scroll = _g.is_scroll
+ if is_scroll == nil then
+ is_scroll = theme.get("text.build.progress_style") == "scroll"
+ _g.is_scroll = is_scroll
+ end
+ if is_scroll then
+ cprint(progress_prefix .. format, progress, ...)
+ else
+ utils.clearline()
+ cprintf(progress_prefix .. format, progress, ...)
+ if math.floor(progress) == 100 then
+ print("")
+ _g.showing_without_scroll = false
+ else
+ _g.showing_without_scroll = true
+ end
+ io.flush()
+ end
end
end