@@ -30,6 +30,9 @@ def teamocil_to_tmuxp(sconf):
3030
3131 tmuxp_config = {}
3232
33+ if 'session' in sconf :
34+ sconf = sconf ['session' ]
35+
3336 if 'project_name' in sconf :
3437 tmuxp_config ['session_name' ] = sconf ['project_name' ]
3538 elif 'name' in sconf :
@@ -552,7 +555,7 @@ class TeamocilLayoutsTest(unittest.TestCase):
552555 }
553556 }
554557
555- tmuxp_dict = [
558+ two_windows = \
556559 {
557560 'session_name' : 'two-windows' ,
558561 'windows' : [
@@ -562,25 +565,25 @@ class TeamocilLayoutsTest(unittest.TestCase):
562565 'layout' : 'tiled' ,
563566 'panes' : [
564567 {
565- 'cmd ' : "echo 'foo'"
568+ 'shell_command ' : "echo 'foo'"
566569 },
567570 {
568- 'cmd ' : "echo 'foo again'"
571+ 'shell_command ' : "echo 'foo again'"
569572 }
570573 ]
571574 },
572575 {
573576 'window_name' : 'bar' ,
574577 'panes' : [
575578 {
576- 'cmd ' : [
579+ 'shell_command ' : [
577580 "echo 'bar'" ,
578581 "echo 'bar in an array'"
579582 ],
580583 'target' : 'bottom-right'
581584 },
582585 {
583- 'cmd ' : [
586+ 'shell_command ' : [
584587 "echo 'bar again'"
585588 ],
586589 'focus' : True ,
@@ -589,16 +592,17 @@ class TeamocilLayoutsTest(unittest.TestCase):
589592 ]
590593 }
591594 ]
592- },
595+ }
596+
597+ two_windows_with_filters = \
593598 {
594599 'session-name' : 'two-windows-with-filters' ,
595- 'windows' :
596- [
600+ 'windows' : [
597601 {
598602 'window_name' : 'foo' ,
599603 'shell_command_before' : [
600- 'echo first before filter' ,
601- 'echo second before filter' ,
604+ 'echo first before filter' ,
605+ 'echo second before filter' ,
602606 ],
603607 'shell_command_after' : [
604608 'echo first after filter' ,
@@ -614,9 +618,11 @@ class TeamocilLayoutsTest(unittest.TestCase):
614618 ]
615619 }
616620 ]
617- },
621+ }
622+
623+ two_windows_with_custom_command_options = \
618624 {
619- 'window -name' : 'two-windows-with-custm -command-options' ,
625+ 'session -name' : 'two-windows-with-custom -command-options' ,
620626 'windows' : [
621627 {
622628 'window_name' : 'foo' ,
@@ -652,38 +658,37 @@ class TeamocilLayoutsTest(unittest.TestCase):
652658 }
653659 ]
654660
655- },
656- {
657- 'session_name' : 'three-window-within-a-session' ,
658- 'windows' : [
659- {
660- 'window_name' : 'first window' ,
661- 'panes' : [
662- {
663- 'shell_command' : "echo 'foo'"
664- },
665- ]
666- },
667- {
668- 'window_name' : 'second window' ,
669- 'panes' : [
670- {
671- 'shell_command' : "echo 'foo'"
672- },
673- ]
674- },
675- {
676- 'window_name' : 'third window' ,
677- 'panes' : [
678- {
679- 'shell_command' : "echo 'foo'"
680- },
681- ]
682- },
683- ]
684661 }
685662
686- ]
663+ three_windows_within_a_session = {
664+ 'session_name' : 'three-window-within-a-session' ,
665+ 'windows' : [
666+ {
667+ 'window_name' : 'first window' ,
668+ 'panes' : [
669+ {
670+ 'shell_command' : "echo 'foo'"
671+ },
672+ ]
673+ },
674+ {
675+ 'window_name' : 'second window' ,
676+ 'panes' : [
677+ {
678+ 'shell_command' : "echo 'foo'"
679+ },
680+ ]
681+ },
682+ {
683+ 'window_name' : 'third window' ,
684+ 'panes' : [
685+ {
686+ 'shell_command' : "echo 'foo'"
687+ },
688+ ]
689+ },
690+ ]
691+ }
687692
688693 def test_config_to_dict (self ):
689694 self .maxDiff = None
@@ -692,8 +697,12 @@ def test_config_to_dict(self):
692697 yaml_to_dict = test_config .get ()
693698 self .assertDictEqual (yaml_to_dict , self .teamocil_dict )
694699
695- # self.assertDictEqual(teamocil_to_tmuxp(self.teamocil_dict),
696- # self.tmuxp_dict)
700+ self .assertDictEqual (
701+ teamocil_to_tmuxp (
702+ self .teamocil_dict ['two-windows' ],
703+ ),
704+ self .two_windows
705+ )
697706
698707 ''' this configuration contains multiple sessions in a single file.
699708 tmuxp can split them into files, proceed?
0 commit comments