dummix update

Former-commit-id: 6340be734589cc536b0dcbdb66580e274115e499
Former-commit-id: 7fc29796780a55f08905c4860f0759b81e4b695a
This commit is contained in:
Song Minjae
2016-10-04 02:03:30 +09:00
parent 0abe3bf052
commit e5bc967ade
3 changed files with 14 additions and 4 deletions

View File

@@ -1,2 +1,6 @@
local args = {...}
if (#args ~= 2) then
print([[usage: cp source_file target_file
cp source_file target_directory]])
return end
fs.cp(os.expandPath(args[1]), os.expandPath(args[2]))

View File

@@ -98,9 +98,11 @@ local function exec(tArgs)
-- do some sophisticated file-matching
-- step 1: exact file
if fs.isFile(fullFilePath) then shell.run(fullFilePath, execArgs)
if fs.exists(fullFilePath) and fs.isFile(fullFilePath) then
shell.run(fullFilePath, execArgs)
-- step 2: try appending ".lua"
elseif fs.isFile(fullFilePath..".lua") then shell.run(fullFilePath..".lua", execArgs)
elseif fs.exists(fullFilePath..".lua") and fs.isFile(fullFilePath..".lua") then
shell.run(fullFilePath..".lua", execArgs)
-- step 3: parse os.path (just like $PATH)
-- step 3.1: exact file; step 3.2: append ".lua"
elseif not startsFromRoot(filePath) then
@@ -110,11 +112,11 @@ local function exec(tArgs)
debug(path..filePath)
if fs.isFile(path..filePath) then
if fs.exists(path..filePath) and fs.isFile(path..filePath) then
execByPathArg = path..filePath
execByPathFileExists = true
break
elseif fs.isFile(path..filePath..".lua") then
elseif fs.exists(path..filePath..".lua") and fs.isFile(path..filePath..".lua") then
execByPathArg = path..filePath..".lua"
execByPathFileExists = true
break

View File

@@ -1,2 +1,6 @@
local args = {...}
if (#args ~= 2) then
print([[usage: mv source target
mv source ... directory]])
return end
fs.mv(os.expandPath(args[1]), os.expandPath(args[2]))