diff options
| author | ruki <[email protected]> | 2016-05-28 19:30:26 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-05-28 19:30:26 +0800 |
| commit | 7a0445c0612e9065461c1dff3eab6e992d742e4d (patch) | |
| tree | bde652f9383c8b73e7e724b17654d2abe612ecd6 /xmake/core/base/option.lua | |
| parent | 125c23d12e9983234c328b805c8da5b8f78ab898 (diff) | |
pass task arguments
Diffstat (limited to 'xmake/core/base/option.lua')
| -rw-r--r-- | xmake/core/base/option.lua | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/xmake/core/base/option.lua b/xmake/core/base/option.lua index 9acf1b48b..5e1ee1adf 100644 --- a/xmake/core/base/option.lua +++ b/xmake/core/base/option.lua @@ -481,25 +481,30 @@ function option.defaults(task) return option._context().defaults end + -- the task menu + local taskmenu = option._taskmenu(task) + -- get the default options for the given task local defaults = {} - for _, o in ipairs(option._taskmenu(task).options) do + if taskmenu then + for _, o in ipairs(taskmenu.options) do - -- key=value? - if o[3] == "kv" then + -- key=value? + if o[3] == "kv" then - -- the key - local key = o[2] or o[1] - assert(key) + -- the key + local key = o[2] or o[1] + assert(key) - -- save the default value - defaults[key] = o[4] + -- save the default value + defaults[key] = o[4] - -- value with name? - elseif o[3] == "v" and o[2] then + -- value with name? + elseif o[3] == "v" and o[2] then - -- save the default value - defaults[o[2]] = o[4] + -- save the default value + defaults[o[2]] = o[4] + end end end |
