Added session-level history suppression.
Kirk MacTavish
8 years ago
240 | 240 |
.. literalinclude:: ../examples/focus-window-and-panes.json
|
241 | 241 |
:language: json
|
242 | 242 |
|
|
243 |
Terminal History
|
|
244 |
----------------
|
|
245 |
|
|
246 |
tmuxp allows ``suppress_history: false`` to override the default command /
|
|
247 |
suppression when building the workspace.
|
|
248 |
This will add the ``shell_command`` to the bash history in the pane.
|
|
249 |
|
|
250 |
YAML
|
|
251 |
~~~~
|
|
252 |
|
|
253 |
.. literalinclude:: ../examples/suppress-history.yaml
|
|
254 |
:language: yaml
|
|
255 |
|
|
256 |
JSON
|
|
257 |
~~~~
|
|
258 |
|
|
259 |
.. literalinclude:: ../examples/suppress-history.json
|
|
260 |
:language: json
|
|
261 |
|
243 | 262 |
Window Index
|
244 | 263 |
------------
|
245 | 264 |
|
1 | 1 |
"windows": [
|
2 | 2 |
{
|
3 | 3 |
"panes": [
|
4 | |
"echo 'in the history!'"
|
|
4 |
"echo 'window in the history!'"
|
5 | 5 |
],
|
6 | 6 |
"focus": true,
|
7 | 7 |
"suppress_history": false,
|
|
9 | 9 |
},
|
10 | 10 |
{
|
11 | 11 |
"panes": [
|
12 | |
"echo 'not in the history!'"
|
|
12 |
"echo 'window not in the history!'"
|
13 | 13 |
],
|
14 | 14 |
"suppress_history": true,
|
15 | 15 |
"window_name": "suppressed"
|
16 | 16 |
},
|
17 | 17 |
{
|
18 | 18 |
"panes": [
|
19 | |
"echo 'default not in the history!'"
|
|
19 |
"echo 'session in the history!'"
|
20 | 20 |
],
|
21 | 21 |
"window_name": "default"
|
22 | 22 |
},
|
23 | 23 |
{
|
24 | 24 |
"panes": [
|
25 | 25 |
{
|
26 | |
"shell_command": "echo 'in the history!'",
|
|
26 |
"shell_command": "echo 'command in the history!'",
|
27 | 27 |
"suppress_history": false
|
28 | 28 |
},
|
29 | 29 |
{
|
30 | |
"shell_command": "echo 'not in the history!'",
|
|
30 |
"shell_command": "echo 'command not in the history!'",
|
31 | 31 |
"suppress_history": true
|
32 | 32 |
},
|
33 | 33 |
{
|
34 | |
"shell_command": "echo 'default not in the history!'"
|
|
34 |
"shell_command": "echo 'window not in the history!'"
|
35 | 35 |
}
|
36 | 36 |
],
|
|
37 |
"suppress_history": true,
|
37 | 38 |
"window_name": "mixed"
|
38 | 39 |
}
|
39 | 40 |
],
|
|
41 |
"suppress_history": false,
|
40 | 42 |
"session_name": "suppress"
|
41 | 43 |
}
|
0 | 0 |
session_name: suppress
|
|
1 |
suppress_history: false
|
1 | 2 |
windows:
|
2 | 3 |
- window_name: appended
|
3 | 4 |
focus: true
|
4 | 5 |
suppress_history: false
|
5 | 6 |
panes:
|
6 | |
- echo "in the history!"
|
|
7 |
- echo "window in the history!"
|
7 | 8 |
|
8 | 9 |
- window_name: suppressed
|
9 | 10 |
suppress_history: true
|
10 | 11 |
panes:
|
11 | |
- echo "not in the history!"
|
|
12 |
- echo "window not in the history!"
|
12 | 13 |
|
13 | 14 |
- window_name: default
|
14 | 15 |
panes:
|
15 | |
- echo "default not in the history!"
|
|
16 |
- echo "session in the history!"
|
16 | 17 |
|
17 | 18 |
- window_name: mixed
|
|
19 |
suppress_history: false
|
18 | 20 |
panes:
|
19 | 21 |
- shell_command:
|
20 | |
- echo "in the history!"
|
|
22 |
- echo "command in the history!"
|
21 | 23 |
suppress_history: false
|
22 | 24 |
- shell_command:
|
23 | |
- echo "not in the history!"
|
|
25 |
- echo "command not in the history!"
|
24 | 26 |
suppress_history: true
|
25 | 27 |
- shell_command:
|
26 | |
- echo "default not in the history!"⏎
|
|
28 |
- echo "window in the history!"⏎
|
308 | 308 |
else:
|
309 | 309 |
session_start_directory = None
|
310 | 310 |
|
|
311 |
if 'suppress_history' in sconf:
|
|
312 |
suppress_history = sconf['suppress_history']
|
|
313 |
else:
|
|
314 |
suppress_history = None
|
|
315 |
|
311 | 316 |
for windowconfig in sconf['windows']:
|
312 | 317 |
|
313 | 318 |
# Prepend start_directory to relative window commands
|
|
324 | 329 |
)
|
325 | 330 |
windowconfig['start_directory'] = window_start_path
|
326 | 331 |
|
|
332 |
# We only need to trickle to the window, workspace builder checks wconf
|
|
333 |
if suppress_history is not None:
|
|
334 |
if not 'suppress_history' in windowconfig:
|
|
335 |
windowconfig['suppress_history'] = suppress_history
|
|
336 |
|
327 | 337 |
for paneconfig in windowconfig['panes']:
|
328 | 338 |
commands_before = []
|
329 | 339 |
|