diff options
| author | ruki <[email protected]> | 2016-06-03 10:25:33 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-06-03 10:25:33 +0800 |
| commit | 122683f02a9d0168f3c68b730f42d657c5a3a8ff (patch) | |
| tree | 5b6bc1929624c7eaee8ea6d7297b3a1dcee49009 /xmake/core/base | |
| parent | e3e2def67c94826326a150859f45a6898fdfc405 (diff) | |
fix option parser bug
Diffstat (limited to 'xmake/core/base')
| -rw-r--r-- | xmake/core/base/option.lua | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/xmake/core/base/option.lua b/xmake/core/base/option.lua index 7deb2a3f4..3760c42d1 100644 --- a/xmake/core/base/option.lua +++ b/xmake/core/base/option.lua @@ -168,9 +168,10 @@ function option.init(menu) -- parse key and value local key, value local i = arg:find("=", 1, true) + local hasspace = arg:find("%s") -- key=value? - if i then + if i and not hasspace then key = arg:sub(1, i - 1) value = arg:sub(i + 1) -- only key? @@ -181,11 +182,11 @@ function option.init(menu) -- --key? local prefix = 0 - if key:startswith("--") then + if not hasspace and key:startswith("--") then key = key:sub(3) prefix = 2 -- -k? - elseif key:startswith("-") then + elseif not hasspace and key:startswith("-") then key = key:sub(2) prefix = 1 end @@ -314,7 +315,7 @@ function option.init(menu) -- value? else - + -- find a value option with name local opt = nil for _, o in ipairs(option._taskmenu().options) do |
