Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Commands
- --server update <id> [version default +1] [pastebin default current] - updates id number program to specified version and pastebin
- --server add <version> <pastebin> - adds new program to database with new id
- --server remove <id> - removes program with specified id
- --server setup -setups turtle in front of computer
- --filesystem of server drive
- --/disk
- -- -> /table.txt
- --filesystem of turtle
- --/programs
- -- -> all programs
- --/table.txt
- --/startup.lua
- function update(id, version, paste)
- print("update")
- end
- function add(version, paste)
- print("add")
- end
- function remove(id)
- print("remove")
- end
- function setupTurtle()
- print("setup")
- end
- --main
- function main(args)
- if args == nil then
- print("Usage: server <command> [args]")
- print("Commands: update, add, remove, setup")
- return
- end
- local argsSize = #args
- print("size " .. tostring(argsSize))
- for s = 1, #args do
- print(args[s])
- end
- --validates command arguments
- if argsSize >= 1 then
- local cmd = args[1]:lower()
- if cmd == "update" then
- --validate command arguments
- if argsSize >= 2 then
- local id = tonumber(args[2]) --id number
- local version = nil
- local pastebin = nil
- if argsSize >= 3 then
- version = tonumber(args[3])
- end
- if argsSize >= 4 then
- pastebin = args[4]
- end
- update(id, version, pastebin)
- else
- print("Usage: server update <id> [version default +1] [pastebin default current]")
- end
- elseif cmd == "add" then
- --validate command arguments
- if argsSize >= 3 then
- local version = tonumber(args[2])
- local pastebin = args[3]
- add(version, pastebin)
- else
- print("Usage: server add <version> <pastebin>")
- end
- elseif cmd == "remove" then
- --validate command arguments
- if argsSize >= 2 then
- local id = tonumber(args[2])
- remove(id)
- else
- print("Usage: server remove <id>")
- end
- elseif cmd == "setup" then
- setupTurtle()
- else
- print("Usage: server <command> [args]")
- print("Commands: update, add, remove, setup")
- end
- else
- print("Usage: server <command> [args]")
- print("Commands: update, add, remove, setup")
- end
- end
- local argIn = {...}
- main(argIn)
Add Comment
Please, Sign In to add comment