summaryrefslogtreecommitdiff
path: root/xmake/core/base/option.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2019-12-20 22:54:20 +0800
committerruki <[email protected]>2019-12-20 11:26:04 +0800
commitb8ef2fa1fdf5d7dcd2b8d076f479bbfbad1a0738 (patch)
tree11ba3859f3356423249f50a2fde4b4460bd6214e /xmake/core/base/option.lua
parent4ce400a33c26c4d59e76ccb5dc321fe6dabc60f7 (diff)
improve help menu
Diffstat (limited to 'xmake/core/base/option.lua')
-rw-r--r--xmake/core/base/option.lua31
1 files changed, 24 insertions, 7 deletions
diff --git a/xmake/core/base/option.lua b/xmake/core/base/option.lua
index 6b522818c..dd9df2aa8 100644
--- a/xmake/core/base/option.lua
+++ b/xmake/core/base/option.lua
@@ -900,7 +900,7 @@ function option.show_menu(task)
-- print options
if taskmenu.options then
- option.show_options(taskmenu.options)
+ option.show_options(taskmenu.options, task)
end
end
@@ -1024,24 +1024,21 @@ function option.show_main()
-- print options
if main.options then
- option.show_options(main.options)
+ option.show_options(main.options, "build")
end
end
-- show the options menu
-function option.show_options(options)
+function option.show_options(options, taskname)
-- check
assert(options)
- -- print header
- io.print("")
- io.print(colors.translate("${bright}Options: "))
-
-- the padding spaces
local padding = 42
-- remove repeat empty lines
+ local is_action = false
local emptyline_count = 0
local printed_options = {}
for _, opt in ipairs(options) do
@@ -1053,11 +1050,31 @@ function option.show_options(options)
if emptyline_count < 2 then
table.insert(printed_options, opt)
end
+ if opt.category and opt.category == "action" then
+ is_action = true
+ end
+ end
+
+ -- print header
+ io.print("")
+ if is_action then
+ io.print(colors.translate("${bright}Common options: "))
+ else
+ io.print(colors.translate("${bright}Options: "))
end
-- print options
options = printed_options
for _, opt in ipairs(options) do
+
+ -- the following options are belong action? show sub-command section
+ --
+ -- @see core/base/task.lua: translate menu
+ --
+ if opt.category and opt.category == "action" then
+ io.print("")
+ io.print(colors.translate("${bright}Sub-command options (" .. taskname .. "): "))
+ end
-- init the option info
local option_info = ""