Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Titan Shell
- -- by Agent Silence
- -- Please message me through the ComputerCraft forums if you have included this in any os!
- OS = false
- OSname = "Put OS filename here"
- blacklist = {
- "Put your blacklisted commands here"
- }
- functionsList = { -- Add your function
- function() -- Prints all previously typed commands
- if #prevTyped < 18 then
- for k, v in ipairs(prevTyped) do
- print(k..": "..v)
- end
- else
- textutils.pagedTabulate(prevTyped)
- end
- end,
- function() -- Clears previously typed commands
- term.clear()
- term.setCursorPos(1,1)
- for i=1,#prevTyped do
- table.remove(prevTyped)
- end
- end ,
- function()
- if OS == false then
- isOnShell = false
- term.setBackgroundColor(colors.black)
- term.clear()
- term.setCursorPos(1,1)
- print("Thank you for using Titan by Agent Silence")
- else
- isOnShell = false
- term.clear()
- shell.run(OSname)
- end
- end,
- function()
- os.unloadAPI("setting")
- shell.run("shell")
- end,
- function()
- shell.setDir("")
- end
- }
- if fs.exists("setting") == false then
- local code = [[
- main = {
- ["Text Color"] = colors.lightGray,
- -- Text color of the console
- ["Background Color"] = colors.black,
- -- Background color
- ["CMD Count"] = true,
- -- Keep track of amount of commands typed
- }
- ]]
- local file = fs.open("setting", "w")
- file.write(code)
- file.close()
- end
- os.loadAPI("setting")
- os.pullEvent = os.pullEventRaw
- prevTyped = { } -- Previously called commands
- aliasList = { }
- aliasNum = { }
- isOnShell = true
- function alias(nPath,alias) -- Calls an alias to a function
- table.insert(aliasList, alias)
- table.insert(aliasNum, nPath)
- end
- term.clear()
- curX, curY = term.getCursorPos(1,1)
- term.setCursorPos(1,1)
- -- Alias's Here --
- alias(1,"prev")
- alias(1,"previous")
- alias(2,"clear")
- alias(2,"empty")
- alias(2,"wipe")
- alias(3,"exit")
- alias(4,"reload")
- alias(4,"rld")
- alias(5,"back")
- alias(5,"main")
- ------------------
- while isOnShell do
- term.setBackgroundColor(setting.main["Background Color"])
- term.setTextColor(colors.green)
- if setting.main["CMD Count"] == false then
- term.write("["..shell.dir().."] ")
- elseif setting.main["CMD Count"] == true then
- term.write("("..#prevTyped..")["..shell.dir().."] ")
- end -- Command Count setting
- term.setTextColor(setting.main["Text Color"])
- input = read()
- if string.sub(input,1,1) == "@" then
- customCode = true
- else
- customCode = false
- end
- for k,v in pairs(aliasList) do
- if v == string.sub(input,2) and customCode == true then
- functionsList[aliasNum[k]]()
- end
- end
- if customCode == false then
- if #input > 0 then
- table.insert(prevTyped, input)
- end
- local marked
- for i,v in pairs(blacklist) do
- if string.sub(input,1,#v) == v then
- marked = true
- end
- end
- if marked ~= true then
- term.setTextColor(colors.white)
- shell.run(input)
- else
- term.setTextColor(colors.red)
- print("Access Denied")
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement