doublequestionmark

Untitled

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