summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-05-06 00:50:29 +0800
committerruki <[email protected]>2021-05-06 00:50:29 +0800
commit286a92d1bd1b1690538b5d5ce7a420dfc81942d6 (patch)
treefbef5fee2633303470a8f3ecc09f8b59a97982ea
parent26468546710f18cdc64f109d57677d370b8b146c (diff)
improve dump color
-rw-r--r--xmake/modules/private/action/require/impl/install_packages.lua4
-rw-r--r--xmake/modules/private/action/require/impl/remove_packages.lua2
-rw-r--r--xmake/modules/private/action/require/info.lua36
-rw-r--r--xmake/modules/private/action/require/list.lua8
-rw-r--r--xmake/modules/private/action/require/search.lua2
5 files changed, 26 insertions, 26 deletions
diff --git a/xmake/modules/private/action/require/impl/install_packages.lua b/xmake/modules/private/action/require/impl/install_packages.lua
index 1e9dcc4f1..2b482b0e9 100644
--- a/xmake/modules/private/action/require/impl/install_packages.lua
+++ b/xmake/modules/private/action/require/impl/install_packages.lua
@@ -288,10 +288,10 @@ function _install_packages(packages_install, packages_download, installdeps)
tty.erase_line_to_start().cr()
cprintf("${yellow} => ")
if #downloading > 0 then
- cprintf("downloading ${magenta}%s", table.concat(downloading, ", "))
+ cprintf("downloading ${color.dump.string}%s", table.concat(downloading, ", "))
end
if #installing > 0 then
- cprintf("%sinstalling ${magenta}%s", #downloading > 0 and ", " or "", table.concat(installing, ", "))
+ cprintf("%sinstalling ${color.dump.string}%s", #downloading > 0 and ", " or "", table.concat(installing, ", "))
end
cprintf(" .. %s", tips and ("${dim}" .. tips .. "${clear} ") or "")
progress_helper:write()
diff --git a/xmake/modules/private/action/require/impl/remove_packages.lua b/xmake/modules/private/action/require/impl/remove_packages.lua
index f2452b8b6..b65627256 100644
--- a/xmake/modules/private/action/require/impl/remove_packages.lua
+++ b/xmake/modules/private/action/require/impl/remove_packages.lua
@@ -75,7 +75,7 @@ function _remove_packagedirs(packagedir, opt)
end
if not opt.clean or status then
local configs_str = _get_package_configs_str(manifest_file) or "[]"
- local description = string.format("remove ${magenta}%s-%s${clear}/${yellow}%s${clear}\n -> ${dim}%s${clear} (${red}%s${clear})", package_name, version, hash, configs_str, status and status or "used")
+ local description = string.format("remove ${color.dump.string}%s-%s${clear}/${yellow}%s${clear}\n -> ${dim}%s${clear} (${red}%s${clear})", package_name, version, hash, configs_str, status and status or "used")
local confirm = utils.confirm({default = true, description = description})
if confirm then
os.rm(hashdir)
diff --git a/xmake/modules/private/action/require/info.lua b/xmake/modules/private/action/require/info.lua
index 963488104..7a6c096c6 100644
--- a/xmake/modules/private/action/require/info.lua
+++ b/xmake/modules/private/action/require/info.lua
@@ -89,30 +89,30 @@ function main(requires_raw)
-- show package name
local requireinfo = instance:requireinfo() or {}
- cprint(" ${magenta}require${clear}(%s): ", requireinfo.originstr)
+ cprint(" ${color.dump.string_quote}require${clear}(%s): ", requireinfo.originstr)
-- show description
local description = instance:get("description")
if description then
- cprint(" -> ${magenta}description${clear}: %s", description)
+ cprint(" -> ${color.dump.string_quote}description${clear}: %s", description)
end
-- show version
local version = instance:version_str()
if version then
- cprint(" -> ${magenta}version${clear}: %s", version)
+ cprint(" -> ${color.dump.string_quote}version${clear}: %s", version)
end
-- show license
local license = instance:get("license")
if license then
- cprint(" -> ${magenta}license${clear}: %s", license)
+ cprint(" -> ${color.dump.string_quote}license${clear}: %s", license)
end
-- show urls
local urls = instance:urls()
if urls and #urls > 0 then
- cprint(" -> ${magenta}urls${clear}:")
+ cprint(" -> ${color.dump.string_quote}urls${clear}:")
for _, url in ipairs(urls) do
print(" -> %s", filter.handle(url, instance))
if git.asgiturl(url) then
@@ -130,13 +130,13 @@ function main(requires_raw)
-- show repository
local repo = instance:repo()
if repo then
- cprint(" -> ${magenta}repo${clear}: %s %s %s", repo:name(), repo:url(), repo:branch() or "")
+ cprint(" -> ${color.dump.string_quote}repo${clear}: %s %s %s", repo:name(), repo:url(), repo:branch() or "")
end
-- show deps
local deps = instance:orderdeps()
if deps and #deps > 0 then
- cprint(" -> ${magenta}deps${clear}:")
+ cprint(" -> ${color.dump.string_quote}deps${clear}:")
for _, dep in ipairs(deps) do
requireinfo = dep:requireinfo() or {}
cprint(" -> %s", requireinfo.originstr)
@@ -144,13 +144,13 @@ function main(requires_raw)
end
-- show cache directory
- cprint(" -> ${magenta}cachedir${clear}: %s", instance:cachedir())
+ cprint(" -> ${color.dump.string_quote}cachedir${clear}: %s", instance:cachedir())
-- show install directory
- cprint(" -> ${magenta}installdir${clear}: %s", instance:installdir())
+ cprint(" -> ${color.dump.string_quote}installdir${clear}: %s", instance:installdir())
-- show search directories and search names
- cprint(" -> ${magenta}searchdirs${clear}: %s", table.concat(table.wrap(core_package.searchdirs()), path.envsep()))
+ cprint(" -> ${color.dump.string_quote}searchdirs${clear}: %s", table.concat(table.wrap(core_package.searchdirs()), path.envsep()))
local searchnames = hashset.new()
for _, url in ipairs(instance:urls()) do
url = filter.handle(url, instance)
@@ -160,17 +160,17 @@ function main(requires_raw)
end
searchnames:insert(url_filename(url))
end
- cprint(" -> ${magenta}searchnames${clear}: %s", table.concat(searchnames:to_array(), ", "))
+ cprint(" -> ${color.dump.string_quote}searchnames${clear}: %s", table.concat(searchnames:to_array(), ", "))
-- show fetch info
- cprint(" -> ${magenta}fetchinfo${clear}: %s", _info(instance))
+ cprint(" -> ${color.dump.string_quote}fetchinfo${clear}: %s", _info(instance))
local fetchinfo = instance:fetch()
if fetchinfo then
for name, info in pairs(fetchinfo) do
if type(info) ~= "table" then
info = tostring(info)
end
- cprint(" -> ${magenta}%s${clear}: %s", name, table.concat(table.wrap(info), " "))
+ cprint(" -> ${color.dump.string_quote}%s${clear}: %s", name, table.concat(table.wrap(info), " "))
end
end
@@ -184,10 +184,10 @@ function main(requires_raw)
else
table.insert(platforms, "all")
end
- cprint(" -> ${magenta}platforms${clear}: %s", table.concat(platforms, ", "))
+ cprint(" -> ${color.dump.string_quote}platforms${clear}: %s", table.concat(platforms, ", "))
-- show requires
- cprint(" -> ${magenta}requires${clear}:")
+ cprint(" -> ${color.dump.string_quote}requires${clear}:")
cprint(" -> ${cyan}plat${clear}: %s", instance:plat())
cprint(" -> ${cyan}arch${clear}: %s", instance:arch())
local configs_required = instance:configs()
@@ -201,7 +201,7 @@ function main(requires_raw)
-- show user configs
local configs_defined = instance:get("configs")
if configs_defined then
- cprint(" -> ${magenta}configs${clear}:")
+ cprint(" -> ${color.dump.string_quote}configs${clear}:")
for _, conf in ipairs(configs_defined) do
local configs_extra = instance:extraconf("configs", conf)
if configs_extra and not configs_extra.builtin then
@@ -225,7 +225,7 @@ function main(requires_raw)
-- show builtin configs
local configs_defined = instance:get("configs")
if configs_defined then
- cprint(" -> ${magenta}configs (builtin)${clear}:")
+ cprint(" -> ${color.dump.string_quote}configs (builtin)${clear}:")
for _, conf in ipairs(configs_defined) do
local configs_extra = instance:extraconf("configs", conf)
if configs_extra and configs_extra.builtin then
@@ -249,7 +249,7 @@ function main(requires_raw)
-- show references
local references = instance:references()
if references then
- cprint(" -> ${magenta}references${clear}:")
+ cprint(" -> ${color.dump.string_quote}references${clear}:")
for projectdir, refdate in pairs(references) do
cprint(" -> %s: %s%s", refdate, projectdir, os.isdir(projectdir) and "" or " ${red}(not found)${clear}")
end
diff --git a/xmake/modules/private/action/require/list.lua b/xmake/modules/private/action/require/list.lua
index 1a7f92f64..f24610d42 100644
--- a/xmake/modules/private/action/require/list.lua
+++ b/xmake/modules/private/action/require/list.lua
@@ -75,17 +75,17 @@ function main()
-- list all required packages
for _, instance in ipairs(package.load_packages(requires, {requires_extra = requires_extra})) do
- cprint(" ${magenta}require${clear}(%s): %s", instance:requireinfo().originstr, _info(instance))
+ cprint(" ${color.dump.string_quote}require${clear}(%s): %s", instance:requireinfo().originstr, _info(instance))
for _, dep in ipairs(instance:orderdeps()) do
- cprint(" -> ${magenta}dep${clear}(%s): %s", dep:requireinfo().originstr, _info(dep))
+ cprint(" -> ${color.dump.string_quote}dep${clear}(%s): %s", dep:requireinfo().originstr, _info(dep))
end
local fetchinfo = instance:fetch()
if fetchinfo then
for name, info in pairs(fetchinfo) do
if type(info) == "table" then
- cprint(" -> ${magenta}%s${clear}: %s", name, table.concat(info, " "))
+ cprint(" -> ${color.dump.string_quote}%s${clear}: %s", name, table.concat(info, " "))
else
- cprint(" -> ${magenta}%s${clear}: %s", name, tostring(info))
+ cprint(" -> ${color.dump.string_quote}%s${clear}: %s", name, tostring(info))
end
end
end
diff --git a/xmake/modules/private/action/require/search.lua b/xmake/modules/private/action/require/search.lua
index 7f76650b5..dc3bdd892 100644
--- a/xmake/modules/private/action/require/search.lua
+++ b/xmake/modules/private/action/require/search.lua
@@ -54,7 +54,7 @@ function main(names)
-- show packages
for _, instance in ipairs(packages) do
local repo = instance:repo()
- cprint(" -> ${magenta}%s${clear}: %s %s", instance:name(), instance:get("description") or "", repo and ("(in " .. repo:name() .. ")") or "")
+ cprint(" -> ${color.dump.string}%s${clear}: %s %s", instance:name(), instance:get("description") or "", repo and ("(in " .. repo:name() .. ")") or "")
end
end
end