From 35f0e3883131e941c25176809fc95a2af50c64d6 Mon Sep 17 00:00:00 2001 From: Martin Sekera Date: Fri, 28 Aug 2020 10:05:08 +0200 Subject: [PATCH] add summary to btv list --- btv | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/btv b/btv index 43ffd05..d75727f 100755 --- a/btv +++ b/btv @@ -345,9 +345,21 @@ def do_list(args): Print a list of existing snapshots. """ + snaps = list_snapshots() + + counts = [ + len([s for s in snaps if s.rank == 0]), + len([s for s in snaps if s.rank == 1]), + len([s for s in snaps if s.rank == 2]) + ] + + print(" > %d/%d Rank 0 snapshots" %(counts[0], cfg.getint("gc", "rank_0_count"))) + print(" > %d/%d Rank 1 snapshots" %(counts[1], cfg.getint("gc", "rank_1_count"))) + print(" > %d/%d Rank 2 snapshots" %(counts[2], cfg.getint("gc", "rank_2_count"))) + print() print("Rank Name") - for snap in list_snapshots(): + for snap in snaps: print(" %d %s %s" %(snap.rank, snap.name, ", ".join(snap.notes))) def do_drop(args):