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 | |
| parent | 4fc3548931420eb7918b03bffecacbc36b4574cd (diff) | |
improve progress spinner
| -rw-r--r-- | xmake/modules/private/utils/progress.lua | 8 | ||||
| -rw-r--r-- | xmake/themes/dark/xmake.lua | 3 | ||||
| -rw-r--r-- | xmake/themes/default/xmake.lua | 5 | ||||
| -rw-r--r-- | xmake/themes/emoji/xmake.lua | 3 | ||||
| -rw-r--r-- | xmake/themes/plain/xmake.lua | 3 | ||||
| -rw-r--r-- | xmake/themes/powershell/xmake.lua | 3 |
6 files changed, 21 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 diff --git a/xmake/themes/dark/xmake.lua b/xmake/themes/dark/xmake.lua index 0af5a1462..d4c63e00f 100644 --- a/xmake/themes/dark/xmake.lua +++ b/xmake/themes/dark/xmake.lua @@ -51,6 +51,9 @@ theme("dark") -- the building target file set_color("build.target", "magenta") + -- the spinner chars + set_text("spinner.chars", '⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏') + -- color dump set_text("dump.default_format", "%s") set_text("dump.udata_format", "%s") diff --git a/xmake/themes/default/xmake.lua b/xmake/themes/default/xmake.lua index 8a6bc0d0e..cef710c04 100644 --- a/xmake/themes/default/xmake.lua +++ b/xmake/themes/default/xmake.lua @@ -51,6 +51,11 @@ theme("default") -- the building target file set_color("build.target", "magenta bright") + -- the spinner chars + set_text("spinner.chars", '⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏') +-- set_text("spinner.chars", '⢎⠀', '⢆⡀', '⢄⡠', '⢀⡰','⠀⡱', '⠈⠱', '⠊⠑', '⠎⠁') +-- set_text("spinner.chars", '\\', '-', '/', '|') + -- color dump set_text("dump.default_format", "%s") set_text("dump.udata_format", "%s") diff --git a/xmake/themes/emoji/xmake.lua b/xmake/themes/emoji/xmake.lua index 43a0effa7..bd1015c38 100644 --- a/xmake/themes/emoji/xmake.lua +++ b/xmake/themes/emoji/xmake.lua @@ -51,6 +51,9 @@ theme("emoji") -- the building target file set_color("build.target", "magenta") + -- the spinner chars + set_text("spinner.chars", '⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏') + -- color dump set_text("dump.default_format", "%s") set_text("dump.udata_format", "%s") diff --git a/xmake/themes/plain/xmake.lua b/xmake/themes/plain/xmake.lua index b47bfaea0..358834384 100644 --- a/xmake/themes/plain/xmake.lua +++ b/xmake/themes/plain/xmake.lua @@ -51,6 +51,9 @@ theme("plain") -- the building target file set_color("build.target", "") + -- the spinner chars + set_text("spinner.chars", '\\', '-', '/', '|') + -- color dump set_text("dump.default_format", "%s") set_text("dump.udata_format", "%s") diff --git a/xmake/themes/powershell/xmake.lua b/xmake/themes/powershell/xmake.lua index e2b9a86ea..457b0fad8 100644 --- a/xmake/themes/powershell/xmake.lua +++ b/xmake/themes/powershell/xmake.lua @@ -51,6 +51,9 @@ theme("powershell") -- the building target file set_color("build.target", "cyan bright") + -- the spinner chars + set_text("spinner.chars", '⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏') + -- color dump set_text("dump.default_format", "%s") set_text("dump.udata_format", "%s") |
