From 89c435adf46bed446772db7c2c36555c6fa0a210 Mon Sep 17 00:00:00 2001
From: Jameson Graef Rollins <jameson.rollins@ligo.org>
Date: Mon, 22 Feb 2021 10:50:31 -0800
Subject: [PATCH] cli: option to recursively list all elements of the budget

---
 gwinc/__main__.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/gwinc/__main__.py b/gwinc/__main__.py
index f74293b1..7f75ccd0 100644
--- a/gwinc/__main__.py
+++ b/gwinc/__main__.py
@@ -102,6 +102,9 @@ group.add_argument(
 group.add_argument(
     '--diff', '-d', metavar='IFO',
     help="show difference table between IFO and another IFO description (name or path) and exit (budget not calculated)")
+group.add_argument(
+    '--list', '-l', action='store_true',
+    help="list all elements of Budget (budget not calculated)")
 parser.add_argument(
     '--no-plot', '-np', action='store_false', dest='plot',
     help="suppress plotting")
@@ -181,6 +184,12 @@ def main():
                 ov = repr(p[2])
                 print(fmt.format(k, v, ov))
         return
+    if args.list:
+        for i in budget.walk():
+            name = '.'.join([n.__class__.__name__ for n in i])
+            type = i[-1].__class__.__bases__[0].__name__
+            print(f'{name} ({type})')
+        return
 
     out_data_files = set()
     out_plot_files = set()
-- 
GitLab