diff options
| author | ruki <[email protected]> | 2015-06-24 14:45:05 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2015-06-24 14:45:05 +0800 |
| commit | 40aeeb7d3f1f2fdc4b2a18fd6654301f4a757394 (patch) | |
| tree | 36ad6fc422d083288a9b3f7c397d0bb2e4723f65 /xmake/scripts/base/option.lua | |
| parent | d9ee17f8892ee0537b5bbc461e760b4a5cb0a763 (diff) | |
fix bug for show help menu
Diffstat (limited to 'xmake/scripts/base/option.lua')
| -rw-r--r-- | xmake/scripts/base/option.lua | 49 |
1 files changed, 24 insertions, 25 deletions
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 |
