add total % to cave-stat

This commit is contained in:
Martinez 2017-11-20 16:25:33 +01:00
parent b17dcc5260
commit 98e4270b26

View file

@ -10,6 +10,7 @@ def cave_stat():
if "--x-of-y" in cmdline:
position = [c for c in cmdline if " of " in c][0]
pos_x, pos_y = [int(a) for a in position.split(" of ")]
if "--destination" in cmdline:
action = "Installing"
@ -19,7 +20,7 @@ def cave_stat():
action = "Downloading"
atom = [c for c in cmdline if "::" in c and c[0] == "="][0]
yield "%s %s (%s)" %(action, atom, position)
yield "%s %s (%s, %.01f %%)" %(action, atom, position, 100 * pos_x / pos_y)
if __name__ == "__main__":
for state in cave_stat():