Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --]] File: Manager [[--
- term.clear()
- term.setBackgroundColor(colors.blue)
- term.setTextColor(colors.white)
- term.clear()
- term.setCursorPos(1,1)
- write "File Command: "
- cmd = read()
- if cmd == "List" or cmd == "list" or cmd == "ls" or cmd == "edit" or cmd == "Edit" or cmd == "create" or cmd == "Create" or cmd == "exit()" then
- ----------------------------------------------------------
- if cmd == "List" or cmd == "list" or cmd == "ls" then
- print "Files: "
- local bAll = false
- local tArgs = { ... }
- if #tArgs > 0 and tArgs[1] == "all" then
- bAll = true
- end
- local tPrograms = shell.programs( bAll )
- textutils.pagedTabulate( tPrograms )
- print "Press Any Key To Continue."
- event = os.pullEvent()
- shell.run("manager")
- ---------------------------------------------------
- function ED()
- term.clear()
- term.setCursorPos(1,1)
- term.setBackgroundColor(colors.blue)
- term.setTextColor(colors.white)
- term.clear()
- write "Edit: "
- ed = read()
- if ed == "exit()" then
- shell.run("gui")
- elseif ed == "back" then
- shell.run("manager")
- elseif fs.exists(ed) then
- shell.run("edit",ed)
- edit()
- else
- print("File: "..ed.." Doesnt Exist")
- sleep(3)
- edit()
- end
- end
- end
- -------------------------------------------------
- function create()
- term.setBackgroundColor(colors.blue)
- term.setTextColor(colors.white)
- term.clear()
- term.setCursorPos(1,1)
- write "CreateFile: "
- cr = read()
- if cr == "exit()"then
- shell.run("gui")
- elseif cr == "back" then
- shell.run("manager")
- elseif fs.exists(cr) then
- print("Error File:"..cr.." Already Exists")
- sleep(2)
- create()
- else
- print("Create File:"..cr.." ?")
- print " [YES] - [NO] "
- local event, button, X, Y = os.pullEventRaw()
- while true do
- if event == "mouse_click" then
- --]] yes selected [[--
- if X >=1 and X <=7 and Y == 3 and button == 1 then
- print "Creating File..."
- sleep(2)
- file = fs.open(cr,"w")
- file.write("--]] File: "..cr.." [[--")
- file.close()
- print "File Created"
- sleep(2)
- create()
- --]] no selected [[--
- elseif X >=9 and X <=14 and Y == 3 and button == 1 then
- print "File Creation Canceled"
- sleep(2)
- create()
- end
- end
- end
- end
- end
- ---------------------------------------------------
- if cmd == "edit" or cmd == "Edit" then
- ED()
- end
- if(cmd == "create" or cmd == "Create") then
- create()
- end
- -----------------------------------------------------
- else
- print "Error Not A Command Commands are edit , create or list"
- sleep(2)
- shell.run("manager")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement