diff options
| author | ruki <[email protected]> | 2020-05-27 23:06:59 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-05-27 12:41:56 +0800 |
| commit | b7eb4f8e297d804d237f018d8de310c970d237ed (patch) | |
| tree | 31380991e458147fed8a414ebbbf3e1cbe591694 /xmake/modules/private/utils/progress.lua | |
| parent | 4fc3548931420eb7918b03bffecacbc36b4574cd (diff) | |
improve progress spinner
Diffstat (limited to 'xmake/modules/private/utils/progress.lua')
| -rw-r--r-- | xmake/modules/private/utils/progress.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/xmake/modules/private/utils/progress.lua b/xmake/modules/private/utils/progress.lua index f95baa088..45f148d5f 100644 --- a/xmake/modules/private/utils/progress.lua +++ b/xmake/modules/private/utils/progress.lua @@ -20,6 +20,7 @@ -- imports import('core.base.object') +import('core.theme.theme') -- print back characters function _make_clearchars(backnum) @@ -75,17 +76,16 @@ end -- @params stream - stream to write to, will use io.stdout if not provided -- @params opt - options -- - chars - an array of chars for progress indicator --- - width - width of progress indicator, will use #opt.chars[0] if not provided +-- - width - width of progress indicator, will use #opt.chars[1] if not provided function new(stream, opt) -- set default values stream = stream or io.stdout opt = opt or {} if opt.chars == nil or #opt.chars == 0 then - opt.chars = {'⢎⠀', '⢆⡀', '⢄⡠', '⢀⡰','⠀⡱', '⠈⠱', '⠊⠑', '⠎⠁'} - opt.width = 2 + opt.chars = theme.get("text.spinner.chars") end opt.width = opt.width or #opt.chars[1] return process { _OPT = opt, _STREAM = stream, _RUNNING = 0, _INDEX = 0, _CLEAR = _make_clearchars(opt.width) } -end
\ No newline at end of file +end |
