Skip to content

Commit 93b4ff1

Browse files
committed
docs(sleep): Sleep command
1 parent aee1e7b commit 93b4ff1

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

docs/examples.md

+27
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,33 @@ Omit sending {kbd}`enter` to key commands. Equivalent to
356356
357357
````
358358

359+
## Pause / delay command execution
360+
361+
```{versionadded} 1.10.0bX
362+
`sleep: [seconds]` option
363+
```
364+
365+
Omit sending {kbd}`enter` to key commands. Equivalent to
366+
[`time.sleep()`](time.sleep) before [`send_keys(enter=False)`](libtmux.Pane.send_keys).
367+
368+
````{tab} YAML
369+
370+
```{literalinclude} ../examples/sleep.yaml
371+
:language: yaml
372+
373+
```
374+
375+
````
376+
377+
````{tab} JSON
378+
379+
```{literalinclude} ../examples/sleep.json
380+
:language: json
381+
382+
```
383+
384+
````
385+
359386
## Window Index
360387

361388
You can specify a window's index using the `window_index` property. Windows

examples/sleep.json

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"session_name": "Should sleep 3 seconds before sending pane commands",
3+
"windows": [
4+
{
5+
"panes": [
6+
{
7+
"shell_command": "echo \"___$((1 + 3))___\"",
8+
"sleep": 3
9+
}
10+
]
11+
}
12+
]
13+
}

examples/sleep.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
session_name: Should sleep 3 seconds before sending pane commands
2+
windows:
3+
- panes:
4+
- shell_command: echo "___$((1 + 3))___"
5+
sleep: 3

0 commit comments

Comments
 (0)