summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOpportunity <[email protected]>2020-01-15 15:16:08 +0800
committerOpportunity <[email protected]>2020-01-15 15:16:08 +0800
commit546d83dd435780a6ea69a5b24a12c06b294dd2c0 (patch)
treed9d98b7c1005dc5df4759d2a3a9d3b0f47eee606
parentd7662a8916400389fca579772bfdaedadd5e640e (diff)
Fix
-rw-r--r--tests/cli/test.lua (renamed from tests/modules/cli/test.lua)2
-rw-r--r--xmake/core/base/cli.lua2
-rw-r--r--xmake/core/base/option.lua5
-rw-r--r--xmake/core/main.lua2
4 files changed, 4 insertions, 7 deletions
diff --git a/tests/modules/cli/test.lua b/tests/cli/test.lua
index 8b3fb58b4..20bc0c735 100644
--- a/tests/modules/cli/test.lua
+++ b/tests/cli/test.lua
@@ -136,4 +136,4 @@ function test_short_flags5(t)
t:are_equal(parsed[1].key, "r")
t:are_equal(parsed[2].type, "arg")
t:are_equal(parsed[2].value, "x d")
-end \ No newline at end of file
+end
diff --git a/xmake/core/base/cli.lua b/xmake/core/base/cli.lua
index 3e78fcdbc..a76d6db23 100644
--- a/xmake/core/base/cli.lua
+++ b/xmake/core/base/cli.lua
@@ -119,4 +119,4 @@ end
cli._segment = segment
-- return module
-return cli \ No newline at end of file
+return cli
diff --git a/xmake/core/base/option.lua b/xmake/core/base/option.lua
index c02a29659..a1f628cdb 100644
--- a/xmake/core/base/option.lua
+++ b/xmake/core/base/option.lua
@@ -26,8 +26,6 @@ local cli = require("base/cli")
local table = require("base/table")
local colors = require("base/colors")
-local dump = require("base/dump")
-
-- ifelse, a? b : c
function option._ifelse(a, b, c)
if a then return b else return c end
@@ -347,9 +345,8 @@ function option.parse(argv, options, opt)
table.insert(o, arg.value)
end
else
- return nil, string.format("Invalid %s: %s", arg.type, arg)
+ return nil, "invalid argument: " .. arg.value
end
- return nil, "invalid argument: " .. arg.value
end
end
end
diff --git a/xmake/core/main.lua b/xmake/core/main.lua
index e0504a376..d54c56228 100644
--- a/xmake/core/main.lua
+++ b/xmake/core/main.lua
@@ -124,7 +124,7 @@ function main._basicparse()
if xmake._ARGV[1] and not xmake._ARGV[1]:startswith('-') then
-- regard it as command name
xmake._COMMAND = xmake._ARGV[1]
- xmake._COMMAND_ARGV = table.move(xmake._ARGV, 2, -1, 1, {})
+ xmake._COMMAND_ARGV = table.move(xmake._ARGV, 2, #xmake._ARGV, 1, {})
else
xmake._COMMAND_ARGV = xmake._ARGV
end