Creeper9207

pro-alias

Nov 29th, 2014
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. local tArgs = { ... }
  2. if #tArgs > 2 then
  3. print( "Usage: alias <alias> <program>" )
  4. return
  5. end
  6.  
  7. local sAlias = tArgs[1]
  8. local sProgram = tArgs[2]
  9.  
  10. if sAlias and sProgram then
  11. -- Set alias
  12. shell.setAlias( sAlias, sProgram )
  13. elseif sAlias then
  14. -- Clear alias
  15. shell.clearAlias( sAlias )
  16. else
  17. -- List aliases
  18. local tAliases = shell.aliases()
  19. local tList = {}
  20. for sAlias, sCommand in pairs( tAliases ) do
  21. table.insert( tList, sAlias )
  22. end
  23. table.sort( tList )
  24. textutils.pagedTabulate( tList )
  25. end
Advertisement
Add Comment
Please, Sign In to add comment