summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2016-11-15 23:08:49 +0800
committerruki <[email protected]>2016-11-15 23:08:55 +0800
commit86cd983996c828c9e0963a4ed25f7338bd19f16c (patch)
tree7e36eadfd499cb0a547fe0a19f5e2f132a0fc1a3
parent583c8523627493099839ef891dc3f887712f66e3 (diff)
support multi-line description for option
-rw-r--r--xmake/core/project/project.lua17
-rw-r--r--xmake/core/project/task.lua14
2 files changed, 22 insertions, 9 deletions
diff --git a/xmake/core/project/project.lua b/xmake/core/project/project.lua
index eb5e2f31f..c0d36b844 100644
--- a/xmake/core/project/project.lua
+++ b/xmake/core/project/project.lua
@@ -748,8 +748,21 @@ function project.menu()
end
-- append it
- if opt:get("description") then
- table.insert(menu, {nil, longname, "kv", default, opt:get("description")})
+ local descriptions = opt:get("description")
+ if descriptions then
+
+ -- define menu option
+ local menu_options = {nil, longname, "kv", default, descriptions}
+
+ -- handle set_description("xx", "xx")
+ if type(descriptions) == "table" then
+ for i, description in ipairs(descriptions) do
+ menu_options[4 + i] = description
+ end
+ end
+
+ -- insert option into menu
+ table.insert(menu, menu_options)
else
table.insert(menu, {nil, longname, "kv", default, nil})
end
diff --git a/xmake/core/project/task.lua b/xmake/core/project/task.lua
index b94685066..a0174e9e8 100644
--- a/xmake/core/project/task.lua
+++ b/xmake/core/project/task.lua
@@ -131,17 +131,17 @@ function task._translate_menu(menu)
-- add common options
table.insert(options, 1, {'v', "verbose", "k", nil, "Print lots of verbose information." })
- table.insert(options, 1, {nil, "backtrace", "k", nil, "Print backtrace information for debugging." })
- table.insert(options, 2, {nil, "version", "k", nil, "Print the version number and exit." })
- table.insert(options, 3, {'h', "help", "k", nil, "Print this help message and exit." })
- table.insert(options, 4, {})
- table.insert(options, 5, {'F', "file", "kv", nil, "Read a given xmake.lua file." })
- table.insert(options, 6, {'P', "project", "kv", nil, "Change to the given project directory."
+ table.insert(options, 2, {nil, "backtrace", "k", nil, "Print backtrace information for debugging." })
+ table.insert(options, 3, {nil, "version", "k", nil, "Print the version number and exit." })
+ table.insert(options, 4, {'h', "help", "k", nil, "Print this help message and exit." })
+ table.insert(options, 5, {})
+ table.insert(options, 6, {'F', "file", "kv", nil, "Read a given xmake.lua file." })
+ table.insert(options, 7, {'P', "project", "kv", nil, "Change to the given project directory."
, "Search priority:"
, " 1. The Given Command Argument"
, " 2. The Envirnoment Variable: XMAKE_PROJECT_DIR"
, " 3. The Current Directory" })
- table.insert(options, 7, {})
+ table.insert(options, 8, {})
end