@@ -75,7 +75,9 @@ def select_option(options, prompt_text, is_group=False):
7575
7676
7777# Get the JSON config file path from environment variable or use a default
78- config_file = os .getenv ("SSHBOX_CONFIG_FILE" , os .path .expanduser ("~/.ssh/sshbox.json" ))
78+ config_file = os .getenv (
79+ "SSHBOX_CONFIG_FILE" , os .path .expanduser ("~/.ssh/sshbox.json" )
80+ )
7981
8082try :
8183 # Load the JSON configuration
@@ -85,7 +87,9 @@ def select_option(options, prompt_text, is_group=False):
8587 configs = create_sample_config ()
8688 save_json_config (configs , config_file )
8789 click .echo (
88- click .style (f"Created sample configuration file: { config_file } " , fg = "green" )
90+ click .style (
91+ f"Created sample configuration file: { config_file } " , fg = "green"
92+ )
8993 )
9094except ValueError as e :
9195 if "Configuration file is empty" in str (e ):
@@ -100,7 +104,7 @@ def select_option(options, prompt_text, is_group=False):
100104 )
101105 else :
102106 click .echo (
103- click .style (f"Error loading configuration: { str (e )} " , err = True , fg = "green " )
107+ click .style (f"Error loading configuration: { str (e )} " , fg = "red " )
104108 )
105109 exit (1 )
106110
@@ -138,7 +142,9 @@ def connect():
138142@cli .command ()
139143def add ():
140144 """Add a new group or host to the configuration."""
141- choice = select_option (["Host" , "Group" ], "Add New Host Or Group?" , is_group = True )
145+ choice = select_option (
146+ ["Host" , "Group" ], "Add New Host Or Group?" , is_group = True
147+ )
142148
143149 if choice == "Group" :
144150 group = click .prompt ("Enter New Group" )
@@ -177,8 +183,10 @@ def add_host_to_group(group=None):
177183 try :
178184 add_host (configs , group , host , host_config )
179185 save_json_config (configs , config_file )
180- click .echod (
181- click .style (f"{ host } added successfully to { group } " , fg = "green" )
186+ click .echo (
187+ click .style (
188+ f"{ host } added successfully to { group } " , fg = "green"
189+ )
182190 )
183191 except ValueError as e :
184192 click .echo (click .style (f"Error: { str (e )} " , fg = "red" ))
@@ -198,12 +206,16 @@ def remove():
198206
199207 if choice == "Group" :
200208 groups = get_groups (configs )
201- group = select_option (groups , "Select Group For Removal" , is_group = True )
209+ group = select_option (
210+ groups , "Select Group For Removal" , is_group = True
211+ )
202212
203213 try :
204214 remove_group (configs , group )
205215 click .echo (
206- click .style (f"Group: { group } removed successfully" , fg = "green" )
216+ click .style (
217+ f"Group: { group } removed successfully" , fg = "green"
218+ )
207219 )
208220 except ValueError as e :
209221 click .echo (click .style (f"Error: { str (e )} " , fg = "red" ))
@@ -217,7 +229,9 @@ def remove():
217229 try :
218230 remove_host (configs , group , host )
219231 click .echo (
220- click .style (f"{ host } removed successfully from { group } " , fg = "green" )
232+ click .style (
233+ f"{ host } removed successfully from { group } " , fg = "green"
234+ )
221235 )
222236 except ValueError as e :
223237 click .echo (click .style (f"Error: { str (e )} " , fg = "red" ))
@@ -232,11 +246,15 @@ def remove():
232246def edit ():
233247 """Edit a group or host in the configuration."""
234248 while True :
235- choice = select_option (["Host" , "Group" ], "Edit Host Or Group?" , is_group = True )
249+ choice = select_option (
250+ ["Host" , "Group" ], "Edit Host Or Group?" , is_group = True
251+ )
236252
237253 if choice == "Group" :
238254 groups = get_groups (configs )
239- old_group = select_option (groups , "Select Group To Edit" , is_group = True )
255+ old_group = select_option (
256+ groups , "Select Group To Edit" , is_group = True
257+ )
240258
241259 new_group = click .prompt (f"Enter New Name For Group: { old_group } " )
242260 try :
0 commit comments