diff options
| author | ruki <[email protected]> | 2015-06-04 22:28:15 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2015-06-04 22:28:24 +0800 |
| commit | 44fd11396d7b073e6b5227894c5db02b3585302f (patch) | |
| tree | d755e4b6bd6c910559a3cb72dd32cd5d0d0e3f7c /xmake/scripts/base/option.lua | |
| parent | f0f9b217ddb81084a411d09a4a23292716b20c46 (diff) | |
impl auto rebuild and fix some bug
Diffstat (limited to 'xmake/scripts/base/option.lua')
| -rw-r--r-- | xmake/scripts/base/option.lua | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/xmake/scripts/base/option.lua b/xmake/scripts/base/option.lua index cdf82adb5..820ba4e6a 100644 --- a/xmake/scripts/base/option.lua +++ b/xmake/scripts/base/option.lua @@ -402,6 +402,35 @@ function option.find(argv, name, shortname) end end +-- get all default options from the given action +function option.defaults(action) + + -- make defaults + local defaults = {} + + -- init the default value + for _, o in ipairs(option._MENU[action or "main"].options) do + + -- key=value? + if o[3] == "kv" then + + -- the key + local key = o[2] or o[1] + assert(key) + + -- save the default value + defaults[key] = o[4] + -- value with name? + elseif o[3] == "v" and o[2] then + -- save the default value + defaults[o[2]] = o[4] + end + end + + -- ok? + return defaults +end + -- print the menu function option.print_menu(action) |
