over-env/bin/cave-stat
2016-06-11 21:43:04 +02:00

20 lines
430 B
Python
Executable file

#! /usr/bin/env python3
# encoding: utf-8
import psutil
def cave_stat():
for proc in psutil.process_iter():
if proc.name() == "cave":
cmdline = proc.cmdline()
if "--x-of-y" in cmdline:
position = cmdline[-1]
dest_idx = cmdline.index("--destination")
atom = cmdline[dest_idx - 1]
yield "Installing %s (%s)" %(atom, position)
if __name__ == "__main__":
for state in cave_stat():
print(state)