summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2019-01-03 22:41:23 +0800
committerruki <[email protected]>2019-01-03 10:08:21 +0800
commit2c8d0f142deeb90f8e2d2ae7962abbc8a62790aa (patch)
tree5c74326301749db7ee0da5a2f0def3678ce39828
parent21539005098febb08e7331e14cae59639c9a21fc (diff)
add status styles
-rw-r--r--xmake/core/project/option.lua2
-rw-r--r--xmake/modules/lib/detect/has_flags.lua4
-rw-r--r--xmake/themes/dark/xmake.lua12
-rw-r--r--xmake/themes/default/xmake.lua13
-rw-r--r--xmake/themes/emoji/xmake.lua12
-rw-r--r--xmake/themes/plain/xmake.lua13
6 files changed, 52 insertions, 4 deletions
diff --git a/xmake/core/project/option.lua b/xmake/core/project/option.lua
index 75866e71b..1dd480197 100644
--- a/xmake/core/project/option.lua
+++ b/xmake/core/project/option.lua
@@ -177,7 +177,7 @@ function option:_check()
end
-- trace
- utils.cprint("checking for the %s ... %s", name, utils.ifelse(self:enabled(), "${green}ok", "${red}no"))
+ utils.cprint("checking for the %s ... %s", name, self:enabled() and "${color.success}${text.success}" or "${color.nothing}${text.nothing}")
if not ok then
os.raise(errors)
end
diff --git a/xmake/modules/lib/detect/has_flags.lua b/xmake/modules/lib/detect/has_flags.lua
index 033574094..237a5fe69 100644
--- a/xmake/modules/lib/detect/has_flags.lua
+++ b/xmake/modules/lib/detect/has_flags.lua
@@ -119,13 +119,13 @@ function main(name, flags, opt)
-- trace
if option.get("verbose") or option.get("diagnosis") or opt.verbose then
- cprint("${dim}checking for the flags (%s) ... %s", table.concat(table.wrap(flags), " "), ifelse(result, "${green}ok", "${red}no"))
+ cprint("${dim}checking for the flags (%s) ... %s", table.concat(table.wrap(flags), " "), result and "${color.success}${text.success}" or "${color.nothing}${text.nothing}")
if option.get("diagnosis") then
cprint("${dim}> %s %s", path.filename(tool.program), table.concat(checkflags, " "))
end
end
if errors and #errors > 0 and option.get("diagnosis") then
- cprint("${yellow}checkinfo:${clear dim} %s", errors:trim())
+ cprint("${color.warning}checkinfo:${clear dim} %s", errors:trim())
end
-- save result to cache
diff --git a/xmake/themes/dark/xmake.lua b/xmake/themes/dark/xmake.lua
index 111ccc211..333cd6b81 100644
--- a/xmake/themes/dark/xmake.lua
+++ b/xmake/themes/dark/xmake.lua
@@ -25,6 +25,18 @@
-- define theme
theme("dark")
+ -- the success status
+ set_text("success", "ok")
+ set_color("success", "green")
+
+ -- the failure status
+ set_text("failure", "failed")
+ set_color("failure", "red")
+
+ -- the nothing status
+ set_text("nothing", "no")
+ set_color("nothing", "red")
+
-- the error info
set_color("error", "red")
set_color("error.dim", "dim red")
diff --git a/xmake/themes/default/xmake.lua b/xmake/themes/default/xmake.lua
index 86e12da85..b8452c479 100644
--- a/xmake/themes/default/xmake.lua
+++ b/xmake/themes/default/xmake.lua
@@ -25,6 +25,18 @@
-- define theme
theme("default")
+ -- the success status
+ set_text("success", "ok")
+ set_color("success", "green")
+
+ -- the failure status
+ set_text("failure", "failed")
+ set_color("failure", "red")
+
+ -- the nothing status
+ set_text("nothing", "no")
+ set_color("nothing", "red")
+
-- the error info
set_color("error", "red")
set_color("error.dim", "dim red")
@@ -47,4 +59,3 @@ theme("default")
set_color("build.target", "magenta")
set_color("build.target.dim", "dim magenta")
-
diff --git a/xmake/themes/emoji/xmake.lua b/xmake/themes/emoji/xmake.lua
index dd31f12c6..223ab467b 100644
--- a/xmake/themes/emoji/xmake.lua
+++ b/xmake/themes/emoji/xmake.lua
@@ -25,6 +25,18 @@
-- define theme
theme("emoji")
+ -- the success status
+ set_text("success", "")
+ set_color("success", "heavy_check_mark")
+
+ -- the failure status
+ set_text("failure", "")
+ set_color("failure", "x")
+
+ -- the nothing status
+ set_text("nothing", "")
+ set_color("nothing", "o")
+
-- the error info
set_color("error", "exclamation")
set_color("error.dim", "exclamation")
diff --git a/xmake/themes/plain/xmake.lua b/xmake/themes/plain/xmake.lua
index 7341eee41..fe66f7511 100644
--- a/xmake/themes/plain/xmake.lua
+++ b/xmake/themes/plain/xmake.lua
@@ -25,6 +25,18 @@
-- define theme
theme("plain")
+ -- the success status
+ set_text("success", "ok")
+ set_color("success", "")
+
+ -- the failure status
+ set_text("failure", "failed")
+ set_color("failure", "")
+
+ -- the nothing status
+ set_text("nothing", "no")
+ set_color("nothing", "")
+
-- the error info
set_color("error", "")
set_color("error.dim", "")
@@ -46,3 +58,4 @@ theme("plain")
-- the building target file
set_color("build.target", "")
set_color("build.target.dim", "")
+