Posted 16 December 2012 - 11:38 AM
So I got tired of deleting a program and making a new one every time I updated it on pastebin, so I tried to write a replace program.
The problem is, I dont think im calling the pastebin function correctly, because every time I run replace, it tells me the proper usage for pastebin.
Any insight?
local yes = 21
local no = 49
tArgs = {...}
fileName = tArgs[1]
pasteBinCode = tArgs[2]
local x, y = term.getCursorPos()
if (#tArgs == 2) then
term.write("Are you sure you want to overwrite " .. fileName .. "? <y/n>")
term.setCursorPos(1,(y+1))
local event, key = os.pullEvent("key")
while ((key ~= yes) and (key ~= no)) do
local event, key = os.pullEvent("key")
end
if key == yes then
shell.run("delete", fileName)
shell.run("pastebin", "get", pastebinCode, fileName)
end
else
term.write("Usage: replace <File Name> <Pastebin Code>")
term.setCursorPos(1,(y+1))
end
The problem is, I dont think im calling the pastebin function correctly, because every time I run replace, it tells me the proper usage for pastebin.
Any insight?