diff options
| author | ruki <[email protected]> | 2015-05-31 11:32:38 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2015-05-31 11:32:38 +0800 |
| commit | 529a623ed4eadb802b5174db0957c595af32d5e5 (patch) | |
| tree | 361a0e7fd30f73af0395886e098d2a3ca2b7164e /xmake/scripts/base/option.lua | |
| parent | ad9d27ef9a74603063755857b0a0191e486c1e8d (diff) | |
add some tools
Diffstat (limited to 'xmake/scripts/base/option.lua')
| -rw-r--r-- | xmake/scripts/base/option.lua | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/xmake/scripts/base/option.lua b/xmake/scripts/base/option.lua index 3da4850c0..5393e0f9b 100644 --- a/xmake/scripts/base/option.lua +++ b/xmake/scripts/base/option.lua @@ -240,19 +240,49 @@ function option.init(argv, menu) local opt = nil for _, o in ipairs(menu[xmake._OPTIONS._ACTION or "main"].options) do + -- the mode + local mode = o[3] + + -- the name + local name = o[2] + -- check - assert(o and (o[3] ~= "v" or o[2])) + assert(o and ((mode ~= "v" and mode ~= "vs") or name)) -- is value and with name? - if o[3] == "v" and o[2] and not xmake._OPTIONS[o[2]] then + if mode == "v" and name and not xmake._OPTIONS[name] then opt = o break + -- is values and with name? + elseif mode == "vs" and name then + opt = o + break end end -- ok? save this value with name opt[2] if opt then - xmake._OPTIONS[opt[2]] = key + + -- the mode + local mode = opt[3] + + -- the name + local name = opt[2] + + -- save value + if mode == "v" then + xmake._OPTIONS[name] = key + elseif mode == "vs" then + -- the option + local o = xmake._OPTIONS[name] + if not o then + xmake._OPTIONS[name] = {} + o = xmake._OPTIONS[name] + end + + -- append value + o[table.getn(o) + 1] = key + end else -- invalid option print("invalid option: " .. arg) @@ -319,6 +349,7 @@ function option.print_menu(action) -- print usage if action.usage then + print("") print("Usage: " .. action.usage) end |
