Skip to content

Commit 0359731

Browse files
committed
Add ability to specify session/global options
Ability to specify ``options`` and ``global_options`` via configuration. Also you can specify environment variables via that. Add tests for it. Update libtmux to v0.5 See also: #65
1 parent eb9c134 commit 0359731

File tree

14 files changed

+171
-49
lines changed

14 files changed

+171
-49
lines changed

CHANGES

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ Changelog
44

55
Here you can find the recent changes to tmuxp
66

7+
- :feature:`65` Ability to specify ``options`` and ``global_options`` via
8+
configuration. Also you can specify environment variables via that.
9+
10+
Include tests.
11+
712
- :release:`1.1.1 <2016-06-02>`
813
- :bug:`167 backported` fix attaching multiple sessions
914
- :bug:`165 backported` fix typo in error output, thanks @fpietka

examples/env-variables.json

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"before_script": "${MY_ENV_VAR}/test3.sh",
2+
"before_script": "${MY_ENV_VAR}/test3.sh",
33
"windows": [
44
{
55
"panes": [
@@ -8,24 +8,26 @@
88
"tail -F /var/log/syslog"
99
]
1010
}
11-
],
12-
"start_directory": "/var/log",
11+
],
12+
"start_directory": "/var/log",
1313
"window_name": "editor"
14-
},
14+
},
1515
{
1616
"panes": [
1717
{
1818
"shell_command": [
19-
"htop",
19+
"htop",
2020
"ls $PWD"
2121
]
2222
}
2323
],
24-
"window_name": "logging for {USER}",
25-
"automatic_rename": true
24+
"window_name": "logging for ${USER}",
25+
"options": {
26+
"automatic-rename": true
27+
}
2628
}
27-
],
28-
"shell_command_before": "echo ${PWD}",
29-
"start_directory": "${PWD}/test",
29+
],
30+
"shell_command_before": "echo ${PWD}",
31+
"start_directory": "${PWD}/test",
3032
"session_name": "session - ${USER} (${MY_ENV_VAR})"
31-
}
33+
}

examples/env-variables.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ windows:
99
- tail -F /var/log/syslog
1010
start_directory: /var/log
1111
- window_name: logging for ${USER}
12-
automatic_rename: true
12+
options:
13+
automatic-rename: true
1314
panes:
1415
- shell_command:
1516
- htop

requirements/base.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
kaptan>=0.5.7
2-
libtmux==0.4.1
2+
libtmux==0.5
33
click==6.6
44
colorama

tests/fixtures/config/expand1.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
},
3333
{
3434
'start_directory': '/var/log',
35-
'options': {'automatic_rename': True, },
35+
'options': {'automatic-rename': True, },
3636
'panes': [
3737
{
3838
'shell_command': 'htop'
@@ -95,7 +95,7 @@
9595
},
9696
{
9797
'start_directory': '/var/log',
98-
'options': {'automatic_rename': True},
98+
'options': {'automatic-rename': True},
9999
'panes': [
100100
{'shell_command': ['htop']},
101101
{'shell_command': ['vim']}

tests/fixtures/config/shell_command_before.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
]
4141
},
4242
{
43-
'options': {'automatic_rename': True, },
43+
'options': {'automatic-rename': True, },
4444
'panes': [
4545
{'shell_command': ['htop']}
4646
]
@@ -92,7 +92,7 @@
9292
]
9393
},
9494
{
95-
'options': {'automatic_rename': True, },
95+
'options': {'automatic-rename': True, },
9696
'panes': [
9797
{'shell_command': ['htop']}
9898
]
@@ -155,7 +155,7 @@
155155
},
156156
{
157157
'start_directory': '/',
158-
'options': {'automatic_rename': True, },
158+
'options': {'automatic-rename': True, },
159159
'panes': [
160160
{
161161
'shell_command': ['htop']
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
session_name: test env vars for options
2+
start_directory: '~'
3+
global_options:
4+
visual-silence: ${VISUAL_SILENCE}
5+
options:
6+
repeat-time: 738
7+
windows:
8+
- window_name: moo
9+
layout: main-horizontal
10+
options:
11+
main-pane-height: ${MAIN_PANE_HEIGHT}
12+
panes:
13+
- pane
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
session_name: test global options
2+
start_directory: '~'
3+
global_options:
4+
repeat-time: 493
5+
status-position: 'top'
6+
windows:
7+
- layout: main-horizontal
8+
panes:
9+
- pane
10+
- pane
11+
- pane
12+
window_name: moo

tests/fixtures/workspacebuilder/pane_ordering.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ session_name: sampleconfig
22
start_directory: {HOME}
33
windows:
44
- options:
5-
- automatic_rename: on
5+
automatic-rename: on
66
layout: tiled
77
panes:
88
- cd /usr/bin
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
session_name: test session options
2+
start_directory: '~'
3+
options:
4+
default-shell: /bin/sh
5+
default-command: /bin/sh
6+
windows:
7+
- layout: main-horizontal
8+
panes:
9+
- pane
10+
- pane
11+
- pane
12+
window_name: moo

0 commit comments

Comments
 (0)