From 40aeeb7d3f1f2fdc4b2a18fd6654301f4a757394 Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 24 Jun 2015 14:45:05 +0800 Subject: fix bug for show help menu --- xmake/scripts/base/option.lua | 49 +++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 25 deletions(-) (limited to 'xmake/scripts/base/option.lua') diff --git a/xmake/scripts/base/option.lua b/xmake/scripts/base/option.lua index 96062b4f8..36963476b 100644 --- a/xmake/scripts/base/option.lua +++ b/xmake/scripts/base/option.lua @@ -653,19 +653,34 @@ function option.print_options(options) print(option_info) -- print more description if exists - for i = 6, #option do + for i = 6, 64 do - -- the description + -- the description, @note some option may be nil local description = option[i] - if description then + if not description then break end - -- is function? get results - if type(description) == "function" then - description = description() + -- is function? get results + if type(description) == "function" then + description = description() + end + + -- the description is string? + if type(description) == "string" then + + -- make spaces + local spaces = "" + for i = 0, padding do + spaces = spaces .. " " end - -- the description is string? - if type(description) == "string" then + -- print this description + print(spaces .. description) + + -- the description is table? + elseif type(description) == "table" then + + -- print all descriptions + for _, v in pairs(description) do -- make spaces local spaces = "" @@ -674,23 +689,7 @@ function option.print_options(options) end -- print this description - print(spaces .. description) - - -- the description is table? - elseif type(description) == "table" then - - -- print all descriptions - for _, v in pairs(description) do - - -- make spaces - local spaces = "" - for i = 0, padding do - spaces = spaces .. " " - end - - -- print this description - print(spaces .. v) - end + print(spaces .. v) end end end -- cgit v1.3.1