@@ -29,25 +29,48 @@ def list(ctx):
29
29
console = Console ()
30
30
31
31
shields_list_response = client .shields .list ()
32
- headers = []
33
- if shields_list_response and len (shields_list_response ) > 0 :
34
- headers = sorted (shields_list_response [0 ].__dict__ .keys ())
32
+ headers = [
33
+ "identifier" ,
34
+ "provider_alias" ,
35
+ "params" ,
36
+ "provider_id" ,
37
+ ]
35
38
36
39
if shields_list_response :
37
- table = Table ()
38
- for header in headers :
39
- table .add_column (header )
40
+ table = Table (
41
+ show_lines = True , # Add lines between rows for better readability
42
+ padding = (0 , 1 ), # Add horizontal padding
43
+ expand = True , # Allow table to use full width
44
+ )
45
+
46
+ table .add_column ("identifier" , style = "bold cyan" , no_wrap = True , overflow = "fold" )
47
+ table .add_column (
48
+ "provider_alias" , style = "yellow" , no_wrap = True , overflow = "fold"
49
+ )
50
+ table .add_column ("params" , style = "magenta" , max_width = 30 , overflow = "fold" )
51
+ table .add_column ("provider_id" , style = "green" , max_width = 20 )
40
52
41
53
for item in shields_list_response :
42
- table .add_row (* [str (getattr (item , header )) for header in headers ])
54
+ table .add_row (
55
+ item .identifier ,
56
+ item .provider_resource_id ,
57
+ str (item .params or "" ),
58
+ item .provider_id ,
59
+ )
60
+
43
61
console .print (table )
44
62
45
63
46
64
@shields .command ()
47
65
@click .option ("--shield-id" , required = True , help = "Id of the shield" )
48
66
@click .option ("--provider-id" , help = "Provider ID for the shield" , default = None )
49
67
@click .option ("--provider-shield-id" , help = "Provider's shield ID" , default = None )
50
- @click .option ("--params" , type = str , help = "JSON configuration parameters for the shield" , default = None )
68
+ @click .option (
69
+ "--params" ,
70
+ type = str ,
71
+ help = "JSON configuration parameters for the shield" ,
72
+ default = None ,
73
+ )
51
74
@click .pass_context
52
75
@handle_client_errors ("register shield" )
53
76
def register (
0 commit comments