diff options
Diffstat (limited to 'xmake/plugins/lua/scripts')
| -rw-r--r-- | xmake/plugins/lua/scripts/cat.lua | 3 | ||||
| -rw-r--r-- | xmake/plugins/lua/scripts/cp.lua | 2 | ||||
| -rw-r--r-- | xmake/plugins/lua/scripts/echo.lua | 5 | ||||
| -rw-r--r-- | xmake/plugins/lua/scripts/lipo.lua | 2 | ||||
| -rw-r--r-- | xmake/plugins/lua/scripts/mkdir.lua | 8 | ||||
| -rw-r--r-- | xmake/plugins/lua/scripts/mv.lua | 7 | ||||
| -rw-r--r-- | xmake/plugins/lua/scripts/rm.lua | 9 | ||||
| -rw-r--r-- | xmake/plugins/lua/scripts/rmdir.lua | 12 | ||||
| -rw-r--r-- | xmake/plugins/lua/scripts/verbose.lua | 40 |
9 files changed, 10 insertions, 78 deletions
diff --git a/xmake/plugins/lua/scripts/cat.lua b/xmake/plugins/lua/scripts/cat.lua index 018b24f24..49536a0e8 100644 --- a/xmake/plugins/lua/scripts/cat.lua +++ b/xmake/plugins/lua/scripts/cat.lua @@ -26,9 +26,8 @@ function main(...) -- cat all - for _, v in ipairs(...) do + for _, v in ipairs(os.argw{...}) do if os.isfile(v) then io.cat(v) end end print("") - end diff --git a/xmake/plugins/lua/scripts/cp.lua b/xmake/plugins/lua/scripts/cp.lua index 72153adb2..5da34feb6 100644 --- a/xmake/plugins/lua/scripts/cp.lua +++ b/xmake/plugins/lua/scripts/cp.lua @@ -24,8 +24,6 @@ -- main function main(...) - - -- copy it os.cp(...) end diff --git a/xmake/plugins/lua/scripts/echo.lua b/xmake/plugins/lua/scripts/echo.lua index 1408adfc1..0714e1c23 100644 --- a/xmake/plugins/lua/scripts/echo.lua +++ b/xmake/plugins/lua/scripts/echo.lua @@ -26,9 +26,8 @@ function main(...) -- echo all - for _, v in ipairs(...) do - printf("%s ", v:decode()) + for _, v in ipairs(os.argw{...}) do + printf("%s ", v) end print("") - end diff --git a/xmake/plugins/lua/scripts/lipo.lua b/xmake/plugins/lua/scripts/lipo.lua index 01212a2b6..9cd9c4c96 100644 --- a/xmake/plugins/lua/scripts/lipo.lua +++ b/xmake/plugins/lua/scripts/lipo.lua @@ -33,7 +33,7 @@ import("core.tool.tool") function main(...) -- get arguments - local args = ... + local args = {...} if not args or #args ~= 1 then raise("invalid arguments!") end diff --git a/xmake/plugins/lua/scripts/mkdir.lua b/xmake/plugins/lua/scripts/mkdir.lua index a3bddc8f0..a3dafb3df 100644 --- a/xmake/plugins/lua/scripts/mkdir.lua +++ b/xmake/plugins/lua/scripts/mkdir.lua @@ -24,12 +24,6 @@ -- main function main(...) - - -- mkdir all - for _, dir in ipairs(...) do - if not os.exists(dir) then - os.mkdir(dir) - end - end + os.mkdir(...) end diff --git a/xmake/plugins/lua/scripts/mv.lua b/xmake/plugins/lua/scripts/mv.lua index d00f95750..9b5c35973 100644 --- a/xmake/plugins/lua/scripts/mv.lua +++ b/xmake/plugins/lua/scripts/mv.lua @@ -24,11 +24,6 @@ -- main function mv.main(...) - - -- mv it - local pathes = ... - if pathes and table.getn(pathes) == 2 then - os.mv(pathes[1], pathes[2]) - end + os.mv(...) end diff --git a/xmake/plugins/lua/scripts/rm.lua b/xmake/plugins/lua/scripts/rm.lua index 3f6b35a8a..2bf625349 100644 --- a/xmake/plugins/lua/scripts/rm.lua +++ b/xmake/plugins/lua/scripts/rm.lua @@ -24,13 +24,6 @@ -- main function main(...) - - -- rm all - for _, file_or_dir in ipairs(...) do - if os.exists(file_or_dir) then - os.rm(file_or_dir) - end - end - + os.rm(...) end diff --git a/xmake/plugins/lua/scripts/rmdir.lua b/xmake/plugins/lua/scripts/rmdir.lua index 15c97f7ae..76739814e 100644 --- a/xmake/plugins/lua/scripts/rmdir.lua +++ b/xmake/plugins/lua/scripts/rmdir.lua @@ -23,13 +23,7 @@ -- -- main -function rmdir.main(self, ...) - - -- rmdir all - for _, dir in ipairs(...) do - if os.isdir(dir) then - os.rmdir(dir) - end - end - +function main(...) + os.rmdir(...) end + diff --git a/xmake/plugins/lua/scripts/verbose.lua b/xmake/plugins/lua/scripts/verbose.lua deleted file mode 100644 index 8ba353655..000000000 --- a/xmake/plugins/lua/scripts/verbose.lua +++ /dev/null @@ -1,40 +0,0 @@ ---!The Make-like Build Utility based on Lua --- --- Licensed to the Apache Software Foundation (ASF) under one --- or more contributor license agreements. See the NOTICE file --- distributed with this work for additional information --- regarding copyright ownership. The ASF licenses this file --- to you under the Apache License, Version 2.0 (the --- "License"); you may not use this file except in compliance --- with the License. You may obtain a copy of the License at --- --- http://www.apache.org/licenses/LICENSE-2.0 --- --- Unless required by applicable law or agreed to in writing, software --- distributed under the License is distributed on an "AS IS" BASIS, --- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. --- See the License for the specific language governing permissions and --- limitations under the License. --- --- Copyright (C) 2015 - 2017, TBOOX Open Source Group. --- --- @author ruki --- @file verbose.lua --- - --- imports -import("core.base.option") - --- main -function main(...) - - -- verbose all - if option.get("verbose") then - for _, v in ipairs(...) do - printf("%s ", v:decode()) - end - print("") - end - -end - |
