diff options
| author | Opportunity <[email protected]> | 2020-01-19 19:32:13 +0800 |
|---|---|---|
| committer | Opportunity <[email protected]> | 2020-01-19 19:32:13 +0800 |
| commit | d0b39e229426a336f71a0cc24f6319a47e2ce975 (patch) | |
| tree | c9ed704cb7ddc3cc95d5f5833086124a4cbf3759 | |
| parent | eb0f4ac9efcdfca4445b7e29f60d978e08e2e532 (diff) | |
fix boolean complete
| -rw-r--r-- | xmake/modules/private/utils/complete.lua | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/xmake/modules/private/utils/complete.lua b/xmake/modules/private/utils/complete.lua index 88b7d6ce4..71c7e9fa3 100644 --- a/xmake/modules/private/utils/complete.lua +++ b/xmake/modules/private/utils/complete.lua @@ -100,6 +100,11 @@ function _complete_option_kv(options, current, completing) if type(values) == "function" then values = values(value) end + if values == nil and type(opt[4]) == "boolean" then + values = { "y", "n" } + -- ignore existing input + value = "" + end for _, v in ipairs(values) do if tostring(v):startswith(value) then _print_candidate(true, "--%s=%s", name, v) @@ -269,13 +274,15 @@ function main(pos, config, ...) local argv = os.argv(word) - -- normailize word to remove "xmake" - if is_host("windows") and argv[1] == "xmake.exe" then - argv[1] = "xmake" - end + if argv[1] then - if argv[1] == "xmake" then - table.remove(argv, 1) + -- normailize word to remove "xmake" + if is_host("windows") and argv[1]:lower() == "xmake.exe" then + argv[1] = "xmake" + end + if argv[1] == "xmake" then + table.remove(argv, 1) + end end if has_space then |
