@@ -195,21 +195,31 @@ def subcommand_convert(args):
195
195
file_user = os .path .join (config_dir , configfile )
196
196
file_cwd = os .path .join (cwd_dir , configfile )
197
197
if os .path .exists (file_cwd ) and os .path .isfile (file_cwd ):
198
- print (file_cwd )
198
+ fullfile = os . path . normpath (file_cwd )
199
199
filename , ext = os .path .splitext (file_cwd )
200
200
elif os .path .exists (file_user ) and os .path .isfile (file_user ):
201
- print (file_user )
201
+
202
+ fullfile = os .path .normpath (file_user )
202
203
filename , ext = os .path .splitext (file_user )
203
204
else :
204
205
logger .error ('%s not found.' % configfile )
205
206
return
206
207
207
208
if 'json' in ext :
208
- if query_yes_no ('convert to %s to yaml?' % (configfile )):
209
- print ('converting' )
209
+ if query_yes_no ('convert to <%s> to yaml?' % (fullfile )):
210
+ configparser = kaptan .Kaptan ()
211
+ configparser .import_config (configfile )
212
+ newfile = fullfile .replace (ext , '.yaml' )
213
+ if query_yes_no ('write config to %s?' % (newfile )):
214
+ print ('written new config to %s' % (newfile ))
210
215
elif 'yaml' in ext :
211
- if query_yes_no ('convert to %s to json?' % (configfile )):
212
- print ('converting' )
216
+ if query_yes_no ('convert to <%s> to json?' % (fullfile )):
217
+ configparser = kaptan .Kaptan ()
218
+ configparser .import_config (configfile )
219
+ newfile = fullfile .replace (ext , '.json' )
220
+ if query_yes_no ('write config to <%s>?' % (newfile )):
221
+ print ('written new config to <%s>.' % (newfile ))
222
+
213
223
214
224
215
225
def subcommand_attach_session (args ):
0 commit comments