summaryrefslogtreecommitdiff
path: root/xmake/core/base/cli.lua
diff options
context:
space:
mode:
authorOpportunity <[email protected]>2020-01-19 13:05:27 +0800
committerOpportunity <[email protected]>2020-01-19 13:05:27 +0800
commitf71f4eef3ff5d13b56a48dee05a0185125626ebd (patch)
treeef5a21bc04477bfacce69d7865a9c9ebc065c70d /xmake/core/base/cli.lua
parent0666ee86336f5f2b33bdf5deb1c19f38ce67ddbd (diff)
add links
Diffstat (limited to 'xmake/core/base/cli.lua')
-rw-r--r--xmake/core/base/cli.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/xmake/core/base/cli.lua b/xmake/core/base/cli.lua
index 9f5fd4344..effa1a0f2 100644
--- a/xmake/core/base/cli.lua
+++ b/xmake/core/base/cli.lua
@@ -18,8 +18,6 @@
-- @file cli.lua
--
--- @see https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html
-
-- define module
local cli = cli or {}
local segment = cli._segment or {}
@@ -62,10 +60,14 @@ function cli._make_option(key, value, short, argv, argi)
return cli._make_segment("option", short and ("-" .. key .. " " .. value) or ("--" .. key .. "=" .. value), argv, argi, { key = key, value = value, short = short or false })
end
-function cli.parse(args, ...)
- return cli.parsev(os.argv(args), ...)
+-- parse a argv string, command & sub-command should be omitted before calling this function
+-- @see https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html
+function cli.parse(args, flags)
+ return cli.parsev(os.argv(args), flags)
end
+-- parse a argv array, command & sub-command should be omitted before calling this function
+-- @see https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap12.html
function cli.parsev(argv, flags)
local parsed = {}