Skip to content

Commit ae37201

Browse files
committed
cli: fix bug where configs would not completely pass through
1 parent fb2afdc commit ae37201

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

tmuxp/cli.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -432,11 +432,11 @@ def command_import_teamocil(args):
432432
if os.path.exists(configfile):
433433
print(configfile)
434434
configparser.import_config(configfile)
435+
newconfig = config.import_tmuxinator(configparser.get())
436+
configparser.import_config(newconfig)
435437
else:
436438
sys.exit('File not found: %s' % configfile)
437439

438-
newconfig = config.import_teamocil(configparser.get())
439-
440440
config_format = prompt_choices('Convert to', choices=[
441441
'yaml', 'json'], default='yaml')
442442

@@ -518,11 +518,11 @@ def command_import_tmuxinator(args):
518518
if os.path.exists(configfile):
519519
print(configfile)
520520
configparser.import_config(configfile)
521+
newconfig = config.import_tmuxinator(configparser.get())
522+
configparser.import_config(newconfig)
521523
else:
522524
sys.exit('File not found: %s' % configfile)
523525

524-
newconfig = config.import_tmuxinator(configparser.get())
525-
526526
config_format = prompt_choices('Convert to', choices=[
527527
'yaml', 'json'], default='yaml')
528528

tmuxp/config.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -240,25 +240,31 @@ def import_tmuxinator(sconf):
240240

241241
tmuxp_config = {}
242242

243+
logger.error(sconf)
244+
243245
if 'project_name' in sconf:
244-
tmuxp_config['session_name'] = sconf['project_name']
246+
tmuxp_config['session_name'] = sconf.pop('project_name')
245247
elif 'name' in sconf:
246-
tmuxp_config['session_name'] = sconf['name']
248+
tmuxp_config['session_name'] = sconf.pop('name')
247249
else:
248250
tmuxp_config['session_name'] = None
249251

252+
logger.error(tmuxp_config)
253+
250254
if 'cli_args' in sconf:
251255
tmuxp_config['config'] = sconf['cli_args']
252256

253257
if '-f' in tmuxp_config['config']:
254258
tmuxp_config['config'] = tmuxp_config[
255-
'config'].replace('-f', '').strip()
259+
'config'
260+
].replace('-f', '').strip()
256261
elif 'tmux_options' in sconf:
257262
tmuxp_config['config'] = sconf['tmux_options']
258263

259264
if '-f' in tmuxp_config['config']:
260265
tmuxp_config['config'] = tmuxp_config[
261-
'config'].replace('-f', '').strip()
266+
'config'
267+
].replace('-f', '').strip()
262268

263269
if 'socket_name' in sconf:
264270
tmuxp_config['socket_name'] = sconf['socket_name']
@@ -267,7 +273,7 @@ def import_tmuxinator(sconf):
267273

268274
if 'tabs' in sconf:
269275
sconf['windows'] = sconf.pop('tabs')
270-
276+
logger.error(tmuxp_config)
271277
if 'pre' in sconf and 'pre_window' in sconf:
272278
tmuxp_config['shell_command'] = sconf['pre']
273279

@@ -287,7 +293,7 @@ def import_tmuxinator(sconf):
287293
tmuxp_config['shell_command_before'].append(
288294
'rbenv shell %s' % sconf['rbenv']
289295
)
290-
296+
logger.error(tmuxp_config)
291297
for w in sconf['windows']:
292298
for k, v in w.items():
293299

@@ -312,10 +318,9 @@ def import_tmuxinator(sconf):
312318
if 'layout' in v:
313319
windowdict['layout'] = v['layout']
314320
tmuxp_config['windows'].append(windowdict)
315-
321+
logger.error(tmuxp_config)
316322
return tmuxp_config
317323

318-
319324
def import_teamocil(sconf):
320325
'''Import yaml configs from `teamocil`_.
321326

0 commit comments

Comments
 (0)