This repository has been archived on 2024-04-19. You can view files and clone it, but cannot push or open issues or pull requests.
FREAX/bin/alias

27 lines
603 B
Text
Raw Permalink Normal View History

2022-07-18 19:33:40 +02:00
local tArgs = { ... }
if #tArgs > 2 then
local programName = "alias"
print("Usage: " .. programName .. " <alias> <program>")
return
end
local sAlias = tArgs[1]
local sProgram = tArgs[2]
if sAlias and sProgram then
-- Set alias
shell.setAlias(sAlias, sProgram)
elseif sAlias then
-- Clear alias
shell.clearAlias(sAlias)
else
-- List aliases
local tAliases = shell.aliases()
local tList = {}
for sAlias, sCommand in pairs(tAliases) do
table.insert(tList, sAlias .. ":" .. sCommand)
end
table.sort(tList)
textutils.pagedTabulate(tList)
end