parent
5d59142b10
commit
b84a250c25
|
@ -8,4 +8,13 @@ Shows help about the command specified or all commands if `all` is specified.
|
|||
Runs Lua code from the command line under the secure environment.
|
||||
|
||||
#### `echo [text]`
|
||||
Print text to the command line.
|
||||
Print text to the command line.
|
||||
|
||||
#### `touch [path]`
|
||||
Create new file.
|
||||
|
||||
#### `rm [path]`
|
||||
Remove file.
|
||||
|
||||
#### `cp [old path] [new path]`
|
||||
Make a copy of a file.
|
|
@ -0,0 +1,4 @@
|
|||
name = cp
|
||||
description = Copy file
|
||||
params = [original path] [copy path]
|
||||
exec = os/exec/cp.lua
|
|
@ -0,0 +1,4 @@
|
|||
name = rm
|
||||
description = Remove file
|
||||
params = [path]
|
||||
exec = os/exec/rm.lua
|
|
@ -0,0 +1,4 @@
|
|||
name = touch
|
||||
description = Create a file
|
||||
params = [path]
|
||||
exec = os/exec/touch.lua
|
|
@ -0,0 +1,21 @@
|
|||
local path = ...
|
||||
local old = path[1]
|
||||
local new = path[2]
|
||||
|
||||
if old and new then
|
||||
if fs.exists(old) then
|
||||
if not fs.exists(new) then
|
||||
if fs.copy(old, new) then
|
||||
print("Copied "..old.." to "..new)
|
||||
else
|
||||
print(old.." is a directory")
|
||||
end
|
||||
else
|
||||
print(new.." already exists")
|
||||
end
|
||||
else
|
||||
print(old.." does not exist")
|
||||
end
|
||||
else
|
||||
print("Must specify original and new path (see help cp)")
|
||||
end
|
|
@ -0,0 +1,16 @@
|
|||
local path = ...
|
||||
path = path[1]
|
||||
|
||||
if path then
|
||||
if fs.exists(path) then
|
||||
if fs.remove(path) then
|
||||
print("Removed file "..path)
|
||||
else
|
||||
print(path.." is a directory")
|
||||
end
|
||||
else
|
||||
print(path.." does not exist")
|
||||
end
|
||||
else
|
||||
print("Must specify path (see help rm)")
|
||||
end
|
|
@ -0,0 +1,16 @@
|
|||
local path = ...
|
||||
path = path[1]
|
||||
|
||||
if path then
|
||||
if not fs.exists(path) then
|
||||
if fs.create(path) then
|
||||
print("Created file "..path)
|
||||
else
|
||||
print("Could not create file "..path)
|
||||
end
|
||||
else
|
||||
print(path.." already exists")
|
||||
end
|
||||
else
|
||||
print("Must specify path (see help touch)")
|
||||
end
|
Loading…
Reference in New Issue