SHOW:
|
|
- or go back to the newest paste.
| 1 | term.clear() | |
| 2 | term.setCursorPos(1,1) | |
| 3 | ||
| 4 | local name = "" | |
| 5 | local code = "" | |
| 6 | local names = {}
| |
| 7 | local codes = {}
| |
| 8 | local count = 0 | |
| 9 | ||
| 10 | while true do | |
| 11 | term.clear() | |
| 12 | term.setCursorPos(1,1) | |
| 13 | print("To stop adding, type STOP in the \"name\" field.")
| |
| 14 | print("Already added "..count.." downloads.")
| |
| 15 | ||
| 16 | write("File name: ")
| |
| 17 | name = read() | |
| 18 | ||
| 19 | if name == "STOP" then break end | |
| 20 | ||
| 21 | write("Pastebin code: ")
| |
| 22 | code = read() | |
| 23 | ||
| 24 | count = count + 1 | |
| 25 | ||
| 26 | names[count] = name | |
| 27 | codes[count] = code | |
| 28 | end | |
| 29 | ||
| 30 | if count == 0 then | |
| 31 | print("Add at least one file!")
| |
| 32 | return | |
| 33 | end | |
| 34 | ||
| 35 | term.clear() | |
| 36 | term.setCursorPos(1,1) | |
| 37 | write("Save as: ")
| |
| 38 | name = read() | |
| 39 | ||
| 40 | local file = fs.open(name, "w") | |
| 41 | ||
| 42 | for i = 1, count do | |
| 43 | file.writeLine([[shell.run("pastebin", "get", "]]..codes[i]..[[", "]]..names[i]..[[")]])
| |
| 44 | file.flush() | |
| 45 | end | |
| 46 | ||
| 47 | file.close() | |
| 48 | ||
| 49 | print("Done! Saved as "..name) |