summaryrefslogtreecommitdiff
path: root/xmake/scripts/tool
diff options
context:
space:
mode:
authorruki <[email protected]>2015-05-31 11:32:38 +0800
committerruki <[email protected]>2015-05-31 11:32:38 +0800
commit529a623ed4eadb802b5174db0957c595af32d5e5 (patch)
tree361a0e7fd30f73af0395886e098d2a3ca2b7164e /xmake/scripts/tool
parentad9d27ef9a74603063755857b0a0191e486c1e8d (diff)
add some tools
Diffstat (limited to 'xmake/scripts/tool')
-rw-r--r--xmake/scripts/tool/cp.lua30
-rw-r--r--xmake/scripts/tool/echo.lua7
-rw-r--r--xmake/scripts/tool/mkdir.lua31
-rw-r--r--xmake/scripts/tool/mv.lua30
-rw-r--r--xmake/scripts/tool/rm.lua31
-rw-r--r--xmake/scripts/tool/rmdir.lua31
6 files changed, 158 insertions, 2 deletions
diff --git a/xmake/scripts/tool/cp.lua b/xmake/scripts/tool/cp.lua
new file mode 100644
index 000000000..344e3e1dd
--- /dev/null
+++ b/xmake/scripts/tool/cp.lua
@@ -0,0 +1,30 @@
+--!The Automatic Cross-platform Build Tool
+--
+-- XMake is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU Lesser General Public License as published by
+-- the Free Software Foundation; either version 2.1 of the License, or
+-- (at your option) any later version.
+--
+-- XMake is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU Lesser General Public License for more details.
+--
+-- You should have received a copy of the GNU Lesser General Public License
+-- along with XMake;
+-- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+--
+-- Copyright (C) 2009 - 2015, ruki All rights reserved.
+--
+-- @author ruki
+-- @file cp.lua
+--
+
+-- cp it
+local pathes = ...
+if pathes and table.getn(pathes) == 2 then
+ return os.cp(pathes[1], pathes[2])
+end
+
+-- failed
+return false
diff --git a/xmake/scripts/tool/echo.lua b/xmake/scripts/tool/echo.lua
index df4f7fa98..eb6cff396 100644
--- a/xmake/scripts/tool/echo.lua
+++ b/xmake/scripts/tool/echo.lua
@@ -20,8 +20,11 @@
-- @file echo.lua
--
--- echo it
-print(...)
+-- echo all
+for _, v in ipairs(...) do
+ io.write(string.format("%s ", v))
+end
+io.write("\n")
-- ok
return true
diff --git a/xmake/scripts/tool/mkdir.lua b/xmake/scripts/tool/mkdir.lua
new file mode 100644
index 000000000..b0c41b310
--- /dev/null
+++ b/xmake/scripts/tool/mkdir.lua
@@ -0,0 +1,31 @@
+--!The Automatic Cross-platform Build Tool
+--
+-- XMake is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU Lesser General Public License as published by
+-- the Free Software Foundation; either version 2.1 of the License, or
+-- (at your option) any later version.
+--
+-- XMake is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU Lesser General Public License for more details.
+--
+-- You should have received a copy of the GNU Lesser General Public License
+-- along with XMake;
+-- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+--
+-- Copyright (C) 2009 - 2015, ruki All rights reserved.
+--
+-- @author ruki
+-- @file mkdir.lua
+--
+
+-- mkdir all
+for _, dir in ipairs(...) do
+ if not os.exists(dir) then
+ os.mkdir(dir)
+ end
+end
+
+-- ok
+return true
diff --git a/xmake/scripts/tool/mv.lua b/xmake/scripts/tool/mv.lua
new file mode 100644
index 000000000..5fc204f7d
--- /dev/null
+++ b/xmake/scripts/tool/mv.lua
@@ -0,0 +1,30 @@
+--!The Automatic Cross-platform Build Tool
+--
+-- XMake is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU Lesser General Public License as published by
+-- the Free Software Foundation; either version 2.1 of the License, or
+-- (at your option) any later version.
+--
+-- XMake is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU Lesser General Public License for more details.
+--
+-- You should have received a copy of the GNU Lesser General Public License
+-- along with XMake;
+-- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+--
+-- Copyright (C) 2009 - 2015, ruki All rights reserved.
+--
+-- @author ruki
+-- @file mv.lua
+--
+
+-- mv it
+local pathes = ...
+if pathes and table.getn(pathes) == 2 then
+ return os.mv(pathes[1], pathes[2])
+end
+
+-- failed
+return false
diff --git a/xmake/scripts/tool/rm.lua b/xmake/scripts/tool/rm.lua
new file mode 100644
index 000000000..370cffd7f
--- /dev/null
+++ b/xmake/scripts/tool/rm.lua
@@ -0,0 +1,31 @@
+--!The Automatic Cross-platform Build Tool
+--
+-- XMake is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU Lesser General Public License as published by
+-- the Free Software Foundation; either version 2.1 of the License, or
+-- (at your option) any later version.
+--
+-- XMake is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU Lesser General Public License for more details.
+--
+-- You should have received a copy of the GNU Lesser General Public License
+-- along with XMake;
+-- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+--
+-- Copyright (C) 2009 - 2015, ruki All rights reserved.
+--
+-- @author ruki
+-- @file rm.lua
+--
+
+-- rm all
+for _, file_or_dir in ipairs(...) do
+ if os.exists(file_or_dir) then
+ os.rm(file_or_dir)
+ end
+end
+
+-- ok
+return true
diff --git a/xmake/scripts/tool/rmdir.lua b/xmake/scripts/tool/rmdir.lua
new file mode 100644
index 000000000..b9b4944a7
--- /dev/null
+++ b/xmake/scripts/tool/rmdir.lua
@@ -0,0 +1,31 @@
+--!The Automatic Cross-platform Build Tool
+--
+-- XMake is free software; you can redistribute it and/or modify
+-- it under the terms of the GNU Lesser General Public License as published by
+-- the Free Software Foundation; either version 2.1 of the License, or
+-- (at your option) any later version.
+--
+-- XMake is distributed in the hope that it will be useful,
+-- but WITHOUT ANY WARRANTY; without even the implied warranty of
+-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+-- GNU Lesser General Public License for more details.
+--
+-- You should have received a copy of the GNU Lesser General Public License
+-- along with XMake;
+-- If not, see <a href="http://www.gnu.org/licenses/"> http://www.gnu.org/licenses/</a>
+--
+-- Copyright (C) 2009 - 2015, ruki All rights reserved.
+--
+-- @author ruki
+-- @file rmdir.lua
+--
+
+-- rmdir all
+for _, dir in ipairs(...) do
+ if os.isdir(dir) then
+ os.rmdir(dir)
+ end
+end
+
+-- ok
+return true