Skip to content

Commit 3a98705

Browse files
committed
Merge remote-tracking branch 'ThiefMaster/shell-command-optional' #76
2 parents 6b04d3c + 10e74fb commit 3a98705

File tree

5 files changed

+34
-1
lines changed

5 files changed

+34
-1
lines changed

examples/blank-panes.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@
3535
}
3636
],
3737
"window_name": "Empty string (return)"
38+
},
39+
{
40+
"panes": [
41+
{
42+
"focus": true
43+
},
44+
{
45+
"start_directory": "/tmp"
46+
}
47+
],
48+
"window_name": "Blank with options"
3849
}
3950
],
4051
"session_name": "Blank pane test"

examples/blank-panes.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,8 @@ windows:
2020
- shell_command: ''
2121
- shell_command:
2222
- ''
23+
# a pane can have other options but still be blank
24+
- window_name: Blank with options
25+
panes:
26+
- focus: true
27+
- start_directory: /tmp

tmuxp/config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,6 @@ def expand(sconf, cwd=None):
209209
}
210210

211211
assert isinstance(p, dict)
212-
assert 'shell_command' in p
213212
if 'shell_command' in p:
214213
cmd = p['shell_command']
215214

@@ -224,6 +223,8 @@ def expand(sconf, cwd=None):
224223
cmd = []
225224

226225
p['shell_command'] = cmd
226+
else:
227+
p['shell_command'] = []
227228

228229
pconf.update(p)
229230
sconf['panes'] = [expand(pane) for pane in sconf['panes']]

tmuxp/testsuite/config.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -947,6 +947,19 @@ class ConfigBlankPanes(TestCase):
947947
],
948948
}
949949
]
950+
},
951+
{
952+
'window_name': 'Blank with options',
953+
'panes': [
954+
{
955+
'shell_command': [],
956+
'focus': True,
957+
},
958+
{
959+
'shell_command': [],
960+
'start_directory': '/tmp',
961+
}
962+
]
950963
}
951964
]
952965
}

tmuxp/testsuite/workspacebuilder.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,9 @@ def test_blank_pane_count(self):
358358
)
359359
self.assertEqual(len(window3._panes), 3)
360360

361+
window4 = self.session.findWhere({'window_name': 'Blank with options'})
362+
self.assertEqual(len(window4._panes), 2)
363+
361364

362365
class StartDirectoryTest(TmuxTestCase):
363366
yaml_config = """

0 commit comments

Comments
 (0)