diff options
| author | ruki <[email protected]> | 2016-05-03 10:18:09 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2016-05-03 10:18:09 +0800 |
| commit | 33cd1abcf4aa733ac68f619dac0183f547d787c3 (patch) | |
| tree | 2c8f669eb26b8484654aa39efeea26d9ec84282f /xmake/core/tool/tool.lua | |
| parent | 6acc7c9d410f46d804a8f278badf14e7e99ea1be (diff) | |
fix find tool bug
Diffstat (limited to 'xmake/core/tool/tool.lua')
| -rw-r--r-- | xmake/core/tool/tool.lua | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/xmake/core/tool/tool.lua b/xmake/core/tool/tool.lua index 94a11f7ef..177df273c 100644 --- a/xmake/core/tool/tool.lua +++ b/xmake/core/tool/tool.lua @@ -54,9 +54,6 @@ function tool._match(name, toolname) -- match the last word? ok if name:find(toolname .. "$") then return 80 end - -- match the partial word? ok - if name:find("%-" .. toolname) then return 60 end - -- contains it? ok if name:find(toolname, 1, true) then return 30 end @@ -79,6 +76,18 @@ function tool._find(root, name) -- remove arguments: -xxx or --xxx name = (name:gsub("%s%-+%w+", " ")) + -- get the last name by ' ': xxx xxx toolname + local names = name:split("%s+") + if #names > 0 then + name = names[#names] + end + + -- get the last name by '-': xxx-xxx-toolname + local names = name:split("%-") + if #names > 0 then + name = names[#names] + end + -- remove suffix: ".xxx" name = (name:gsub("%.%w+", "")) |
