trun-ls.lua (396B)
1 #!/usr/bin/env lua 2 -- list running truns 3 -- 4 -- Usage: trun-ls.lua 5 6 -- Config 7 local status_dir_def = os.getenv('XDG_CACHE_HOME') .. '/trun' 8 local status_dir = os.getenv('TRUN_STATUS_DIR') or status_dir_def 9 10 -- silent fail if dir not exists 11 if not io.open(status_dir) then 12 return '' 13 end 14 15 -- get all status files 16 local list = io.popen('ls ' .. status_dir) 17 for f in list:lines() do 18 print(f) 19 end 20