@@ -23,7 +23,7 @@ def import_tmuxinator(workspace_dict: dict[str, t.Any]) -> WorkspaceConfig:
23
23
dict
24
24
A dictionary conforming to WorkspaceConfig structure.
25
25
"""
26
- tmuxp_workspace : WorkspaceConfig = {"windows " : []} # type: ignore[typeddict-item]
26
+ tmuxp_workspace : WorkspaceConfig = {"session_name " : None , "windows" : []}
27
27
28
28
if "project_name" in workspace_dict :
29
29
tmuxp_workspace ["session_name" ] = workspace_dict .pop ("project_name" )
@@ -75,6 +75,15 @@ def import_tmuxinator(workspace_dict: dict[str, t.Any]) -> WorkspaceConfig:
75
75
if "rbenv" in workspace_dict :
76
76
if "shell_command_before" not in tmuxp_workspace :
77
77
tmuxp_workspace ["shell_command_before" ] = []
78
+ else :
79
+ # Ensure shell_command_before is a list
80
+ current = tmuxp_workspace ["shell_command_before" ]
81
+ if isinstance (current , str ):
82
+ tmuxp_workspace ["shell_command_before" ] = [current ]
83
+ elif isinstance (current , dict ):
84
+ tmuxp_workspace ["shell_command_before" ] = [current ]
85
+ # Now we can safely append
86
+ assert isinstance (tmuxp_workspace ["shell_command_before" ], list )
78
87
tmuxp_workspace ["shell_command_before" ].append (
79
88
"rbenv shell {}" .format (workspace_dict ["rbenv" ]),
80
89
)
@@ -83,10 +92,14 @@ def import_tmuxinator(workspace_dict: dict[str, t.Any]) -> WorkspaceConfig:
83
92
for k , v in window_item .items ():
84
93
new_window : WindowConfig = {"window_name" : k }
85
94
86
- if isinstance (v , str ) or v is None :
95
+ if isinstance (v , str ):
87
96
new_window ["panes" ] = [v ]
88
97
tmuxp_workspace ["windows" ].append (new_window )
89
98
continue
99
+ if v is None :
100
+ new_window ["panes" ] = ["" ] # Empty pane
101
+ tmuxp_workspace ["windows" ].append (new_window )
102
+ continue
90
103
if isinstance (v , list ):
91
104
new_window ["panes" ] = v
92
105
tmuxp_workspace ["windows" ].append (new_window )
@@ -130,7 +143,7 @@ def import_teamocil(workspace_dict: dict[str, t.Any]) -> WorkspaceConfig:
130
143
- clear
131
144
- cmd_separator
132
145
"""
133
- tmuxp_workspace : WorkspaceConfig = {"windows " : []} # type: ignore[typeddict-item]
146
+ tmuxp_workspace : WorkspaceConfig = {"session_name " : None , "windows" : []}
134
147
135
148
if "session" in workspace_dict :
136
149
workspace_dict = workspace_dict ["session" ]
0 commit comments