File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import typer
22from rich import print
3- from rich .table import Table
43
54from .client import EnvironmentClient , cycleops_client
65from .exceptions import NotFound
Original file line number Diff line number Diff line change 11import typer
22from rich import print
3- from rich .table import Table
43
54from .client import UnitClient , cycleops_client
65from .exceptions import NotFound
@@ -18,20 +17,23 @@ def list() -> None:
1817 """
1918
2019 try :
21- if all :
22- units = unit_client .list ()
23-
24- if not units :
25- raise NotFound ("No units available" )
26-
27- table = Table (show_header = True , leading = True )
28- table .add_column ("ID" , width = 5 )
29- table .add_column ("Name" , width = 30 )
30-
31- for unit in units :
32- table .add_row (str (unit ["id" ]), unit ["name" ])
33-
34- print (table )
20+ raw_units = unit_client .list ()
21+
22+ if not raw_units :
23+ raise NotFound ("No units available" )
24+
25+ units = [
26+ {
27+ "id" : raw_unit .get ("id" ),
28+ "name" : raw_unit .get ("name" ),
29+ "type_slug" : raw_unit .get ("type_slug" ),
30+ "service_groups_slugs" : raw_unit .get ("service_groups_slugs" ),
31+ }
32+ for raw_unit in raw_units
33+ if raw_unit .get ("type_slug" ) != "system"
34+ ]
35+
36+ print (units )
3537 except Exception as error :
3638 display_error_message (error )
3739 raise typer .Exit (code = 1 )
You can’t perform that action at this time.
0 commit comments