Skip to content

Commit 7ee9e53

Browse files
committed
Fix teamocil import. Add start_directory support for teamocil.
1 parent a7715b6 commit 7ee9e53

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

tmuxp/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ def command_import_teamocil(args):
452452
if os.path.exists(configfile):
453453
print(configfile)
454454
configparser.import_config(configfile)
455-
newconfig = config.import_tmuxinator(configparser.get())
455+
newconfig = config.import_teamocil(configparser.get())
456456
configparser.import_config(newconfig)
457457
else:
458458
sys.exit('File not found: %s' % configfile)

tmuxp/config.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,9 @@ def import_teamocil(sconf):
395395
else:
396396
tmuxp_config['session_name'] = None
397397

398+
if 'root' in sconf:
399+
tmuxp_config['start_directory'] = sconf.pop('root')
400+
398401
tmuxp_config['windows'] = []
399402

400403
for w in sconf['windows']:
@@ -413,6 +416,9 @@ def import_teamocil(sconf):
413416
for b in w['filters']['after']:
414417
windowdict['shell_command_after'] = w['filters']['after']
415418

419+
if 'root' in w:
420+
windowdict['start_directory'] = w.pop('root')
421+
416422
if 'splits' in w:
417423
w['panes'] = w.pop('splits')
418424

tmuxp/testsuite/test_config_teamocil.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class TeamocilTest(TestCase):
5050
{
5151
'window_name': 'sample-two-panes',
5252
'layout': 'even-horizontal',
53+
'start_directory': '~/Code/sample/www',
5354
'panes': [
5455
{
5556
'shell_command': [
@@ -124,6 +125,7 @@ class Teamocil2Test(TestCase):
124125
{
125126
'window_name': 'sample-four-panes',
126127
'layout': 'tiled',
128+
'start_directory': '~/Code/sample/www',
127129
'panes': [
128130
{
129131
'shell_command': 'pwd'
@@ -206,6 +208,7 @@ class Teamocil3Test(TestCase):
206208
{
207209
'window_name': 'my-first-window',
208210
'layout': 'even-vertical',
211+
'start_directory': "~/Projects/foo-www",
209212
'shell_command_before': 'rbenv local 2.0.0-p0',
210213
'shell_command_after': 'echo \'I am done initializing this pane.\'',
211214
'panes': [
@@ -272,6 +275,7 @@ class Teamocil4Test(TestCase):
272275
'windows': [
273276
{
274277
'window_name': 'erb-example',
278+
'start_directory': "<%= ENV['MY_PROJECT_ROOT'] %>",
275279
'panes': [
276280
{
277281
'shell_command': 'pwd'
@@ -530,6 +534,7 @@ class TeamocilLayoutsTest(TestCase):
530534
'windows': [
531535
{
532536
'window_name': 'foo',
537+
'start_directory': '/foo',
533538
'clear': True,
534539
'layout': 'tiled',
535540
'panes': [
@@ -543,6 +548,7 @@ class TeamocilLayoutsTest(TestCase):
543548
},
544549
{
545550
'window_name': 'bar',
551+
'start_directory': '/bar',
546552
'panes': [
547553
{
548554
'shell_command': [
@@ -566,6 +572,7 @@ class TeamocilLayoutsTest(TestCase):
566572
'windows': [
567573
{
568574
'window_name': 'foo',
575+
'start_directory': '/foo',
569576
'shell_command_before': [
570577
'echo first before filter',
571578
'echo second before filter',
@@ -592,6 +599,7 @@ class TeamocilLayoutsTest(TestCase):
592599
'windows': [
593600
{
594601
'window_name': 'foo',
602+
'start_directory': '/foo',
595603
'clear': True,
596604
'layout': 'tiled',
597605
'panes': [
@@ -605,6 +613,7 @@ class TeamocilLayoutsTest(TestCase):
605613
},
606614
{
607615
'window_name': 'bar',
616+
'start_directory': '/bar',
608617
'panes': [
609618
{
610619
'shell_command': [

0 commit comments

Comments
 (0)