Alyssa

List

Aug 8th, 2013
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.57 KB | None | 0 0
  1.  
  2. local Args = { ... }
  3. local dirs = shell.dir()
  4. if Args[1] ~= nil then
  5.  dirs = shell.resolve( Args[1] )
  6. end
  7. local all = fs.list( dirs )
  8. local files = {}
  9. local directories = {}
  10.  
  11. for i, items in pairs ( all ) do
  12.  local path = fs.combine( dirs, items )
  13.  if fs.isDir( path ) then
  14.   table.insert( directories, items )
  15.  else
  16.   table.insert( files, items )
  17.  end
  18. end
  19.  
  20. table.sort( directories )
  21. table.sort( files)
  22.  
  23. if term.isColor() then
  24.  textutils.pagedTabulate( colors.blue, directories, colors.yellow, files )
  25. else
  26.  textutils.pagedTabulate( directories, files )
  27. end
Advertisement
Add Comment
Please, Sign In to add comment