Skip to content

Commit 5a86a95

Browse files
committed
docs(quickstart): Add raw commands
1 parent 7552e3b commit 5a86a95

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

docs/quickstart.md

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,44 @@ equivalent to `$ tmux -L mysocket`.
120120
`server` is now a living object bound to the tmux server's Sessions,
121121
Windows and Panes.
122122

123+
## Raw, contextual commands
124+
125+
New session:
126+
127+
```python
128+
>>> server.cmd('new-session', '-d', '-P', '-F#{session_id}').stdout[0]
129+
'$2'
130+
```
131+
132+
```python
133+
>>> session.cmd('new-window', '-P').stdout[0]
134+
'libtmux...:2.0'
135+
```
136+
137+
Time for some tech, direct to a rich, `Window` object:
138+
139+
```python
140+
>>> Window.from_window_id(window_id=session.cmd('new-window', '-P', '-F#{window_id}').stdout[0], server=session.server)
141+
Window(@2 2:..., Session($1 libtmux_...))
142+
```
143+
144+
Create a pane from a window:
145+
146+
```python
147+
>>> window.cmd('split-window', '-P', '-F#{pane_id}').stdout[0]
148+
'%2'
149+
```
150+
151+
Magic, directly to a `Pane`:
152+
153+
```python
154+
>>> Pane.from_pane_id(pane_id=session.cmd('split-window', '-P', '-F#{pane_id}').stdout[0], server=session.server)
155+
Pane(%... Window(@1 1:..., Session($1 libtmux_...)))
156+
```
157+
123158
## Find your {class}`Session`
124159

125-
If you have multiple tmux sessions open, you can see that all of the
126-
methods in {class}`Server` are available.
160+
If you have multiple tmux sessions open, all methods in {class}`Server` are available.
127161

128162
We can list sessions with {meth}`Server.sessions`:
129163

0 commit comments

Comments
 (0)