diff options
| author | ruki <[email protected]> | 2019-10-18 22:33:45 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2019-10-18 09:22:31 +0800 |
| commit | 2b075f93f9a3111d3c0439f13f77c079ba8c2ac0 (patch) | |
| tree | c0262cd6c6ae9e6b3cbc2459587ed533590aa440 /xmake/core/sandbox/modules/utils.lua | |
| parent | 7ef0d3eac5452a5c71f0ad9f7010d376c1f70e4c (diff) | |
improve install tips
Diffstat (limited to 'xmake/core/sandbox/modules/utils.lua')
| -rw-r--r-- | xmake/core/sandbox/modules/utils.lua | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/xmake/core/sandbox/modules/utils.lua b/xmake/core/sandbox/modules/utils.lua index f71d2a72b..9773d92a5 100644 --- a/xmake/core/sandbox/modules/utils.lua +++ b/xmake/core/sandbox/modules/utils.lua @@ -167,6 +167,31 @@ function sandbox_utils.dprintf(format, ...) end end +-- clear the current terminal line +function sandbox_utils.clearline() + + -- get empty line chars + local emptychars = sandbox_utils._EMPTYCHARS + if not emptychars then + + -- get left width + local width = os.getwinsize()["width"] - 1 + if not width or width <= 0 then + width = 64 + end + + -- make empty chars + emptychars = "" + for i = 1, width do + emptychars = emptychars .. " " + end + sandbox_utils._EMPTYCHARS = emptychars + end + + -- clear line + sandbox_utils.printf("\r" .. emptychars .. "\r") +end + -- assert function sandbox_utils.assert(value, format, ...) |
