summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-01-28 22:33:28 +0800
committerruki <[email protected]>2021-01-28 22:33:28 +0800
commit72673d7d9c5d800b8ea29e645c05a118f3ab7059 (patch)
treed86bf3bfb1ebaf01a5194140b981ec85e9afa40d
parent8447e1533afbd9a1c08fb434ada4e2b3408cb689 (diff)
add os.term
-rw-r--r--xmake/core/base/os.lua5
-rw-r--r--xmake/core/sandbox/modules/interpreter/os.lua1
-rw-r--r--xmake/core/sandbox/modules/os.lua1
-rw-r--r--xmake/themes/default/xmake.lua9
-rw-r--r--xmake/themes/powershell/xmake.lua6
5 files changed, 19 insertions, 3 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua
index 099ceb799..ff79aeb96 100644
--- a/xmake/core/base/os.lua
+++ b/xmake/core/base/os.lua
@@ -971,6 +971,11 @@ function os.fscase()
return os._FSCASE
end
+-- get term
+function os.term()
+ return require("base/tty").term()
+end
+
-- get all current environment variables
function os.getenvs()
local envs = {}
diff --git a/xmake/core/sandbox/modules/interpreter/os.lua b/xmake/core/sandbox/modules/interpreter/os.lua
index bc3675633..c38c5de68 100644
--- a/xmake/core/sandbox/modules/interpreter/os.lua
+++ b/xmake/core/sandbox/modules/interpreter/os.lua
@@ -27,6 +27,7 @@ local interpreter = require("base/interpreter")
local sandbox_os = sandbox_os or {}
-- export some readonly interfaces
+sandbox_os.term = os.term
sandbox_os.host = os.host
sandbox_os.arch = os.arch
sandbox_os.subhost = os.subhost
diff --git a/xmake/core/sandbox/modules/os.lua b/xmake/core/sandbox/modules/os.lua
index 7633801d3..6e29f5801 100644
--- a/xmake/core/sandbox/modules/os.lua
+++ b/xmake/core/sandbox/modules/os.lua
@@ -33,6 +33,7 @@ local vformat = require("sandbox/modules/vformat")
local sandbox_os = sandbox_os or {}
-- inherit some builtin interfaces
+sandbox_os.term = os.term
sandbox_os.host = os.host
sandbox_os.arch = os.arch
sandbox_os.subhost = os.subhost
diff --git a/xmake/themes/default/xmake.lua b/xmake/themes/default/xmake.lua
index 275ac6481..7c884237e 100644
--- a/xmake/themes/default/xmake.lua
+++ b/xmake/themes/default/xmake.lua
@@ -77,8 +77,13 @@ theme("default")
set_color("dump.function", "cyan")
-- menu
- set_color("menu.main.task.name", "magenta")
- set_color("menu.option.name", "green")
+ if is_subhost("widows") and os.term() == "powershell" then
+ set_color("menu.main.task.name", "cyan bright")
+ set_color("menu.option.name", "green bright")
+ else
+ set_color("menu.main.task.name", "magenta")
+ set_color("menu.option.name", "green")
+ end
set_color("menu.usage", "cyan")
-- interactive mode
diff --git a/xmake/themes/powershell/xmake.lua b/xmake/themes/powershell/xmake.lua
index 3a79a2145..3210d7188 100644
--- a/xmake/themes/powershell/xmake.lua
+++ b/xmake/themes/powershell/xmake.lua
@@ -53,7 +53,11 @@ theme("powershell")
set_color("build.target", "cyan bright")
-- the spinner chars
- set_text("spinner.chars", '⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏')
+ if (is_subhost("windows") and winos.version():lt("win10")) or is_subhost("msys", "cygwin") then
+ set_text("spinner.chars", '\\', '-', '/', '|')
+ else
+ set_text("spinner.chars", '⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏')
+ end
-- color dump
set_text("dump.default_format", "%s")