summaryrefslogtreecommitdiff
path: root/xmake/core/sandbox/modules
diff options
context:
space:
mode:
authorruki <[email protected]>2019-08-24 00:05:33 +0800
committerruki <[email protected]>2019-08-23 18:33:23 +0800
commit863b2c74551f802b460b228e341bd96aa8aeaba1 (patch)
treeedb9799f1056f1942b3ec5c5292f698cb1ed0106 /xmake/core/sandbox/modules
parent8e5875a886b5a4a82cf1350ebfcbc55f34262e80 (diff)
bcsave for directory
Diffstat (limited to 'xmake/core/sandbox/modules')
-rw-r--r--xmake/core/sandbox/modules/import/core/base/option.lua29
1 files changed, 15 insertions, 14 deletions
diff --git a/xmake/core/sandbox/modules/import/core/base/option.lua b/xmake/core/sandbox/modules/import/core/base/option.lua
index 660560a22..fab7d3dc4 100644
--- a/xmake/core/sandbox/modules/import/core/base/option.lua
+++ b/xmake/core/sandbox/modules/import/core/base/option.lua
@@ -81,17 +81,21 @@ function sandbox_core_base_option.parse(argv, options, ...)
table.insert(options, 2, {'h', "help", "k", nil, "Print this help message and exit." })
table.insert(options, 3, {})
+ -- show help
+ local descriptions = {...}
+ local function show_help()
+ for _, description in ipairs(descriptions) do
+ print(description)
+ end
+ option.show_options(options)
+ end
+
-- parse it
local results, errors = option.parse(argv, options)
if not results then
- -- show descriptions
- for _, description in ipairs({...}) do
- print(description)
- end
-
- -- show options
- option.show_options(options)
+ -- show help
+ show_help()
-- raise errors
raise(errors)
@@ -100,16 +104,13 @@ function sandbox_core_base_option.parse(argv, options, ...)
-- help?
if results.help then
- -- show descriptions
- for _, description in ipairs({...}) do
- print(description)
- end
-
- -- show options
- option.show_options(options)
+ -- show help
+ show_help()
-- exit
raise()
+ else
+ results.help = show_help
end
-- ok