@@ -187,15 +187,29 @@ def subcommand_convert(args):
187
187
else :
188
188
print ('No tmuxp configs found in current directory.' )
189
189
190
- for configfile in args .configs :
191
- file_user = os .path .join (config_dir , configfile )
192
- file_cwd = os .path .join (cwd_dir , configfile )
193
- if os .path .exists (file_cwd ) and os .path .isfile (file_cwd ):
194
- print (file_cwd )
195
- elif os .path .exists (file_user ) and os .path .isfile (file_user ):
196
- print (file_user )
197
- else :
198
- logger .error ('%s not found.' % configfile )
190
+ try :
191
+ configfile = args .configs [0 ]
192
+ except Exception :
193
+ print ('Please enter a config' )
194
+
195
+ file_user = os .path .join (config_dir , configfile )
196
+ file_cwd = os .path .join (cwd_dir , configfile )
197
+ if os .path .exists (file_cwd ) and os .path .isfile (file_cwd ):
198
+ print (file_cwd )
199
+ filename , ext = os .path .splitext (file_cwd )
200
+ elif os .path .exists (file_user ) and os .path .isfile (file_user ):
201
+ print (file_user )
202
+ filename , ext = os .path .splitext (file_user )
203
+ else :
204
+ logger .error ('%s not found.' % configfile )
205
+ return
206
+
207
+ if 'json' in ext :
208
+ if query_yes_no ('convert to %s to yaml?' % (configfile )):
209
+ print ('converting' )
210
+ elif 'yaml' in ext :
211
+ if query_yes_no ('convert to %s to json?' % (configfile )):
212
+ print ('converting' )
199
213
200
214
201
215
def subcommand_attach_session (args ):
@@ -345,6 +359,8 @@ def main():
345
359
346
360
if args .callback is subcommand_load :
347
361
subcommand_load (args )
362
+ elif args .callback is subcommand_convert :
363
+ subcommand_convert (args )
348
364
elif args .callback is subcommand_attach_session :
349
365
subcommand_attach_session (args )
350
366
elif args .callback is subcommand_kill_session :
0 commit comments