Skip to content

Commit 37c3183

Browse files
committed
docs: Base indexes
This makes the docs look more realistic, but we need to make it work across tmux versions and python versions put into the CI matrix.
1 parent 2aa5408 commit 37c3183

File tree

4 files changed

+40
-40
lines changed

4 files changed

+40
-40
lines changed

README.md

+13-13
Original file line numberDiff line numberDiff line change
@@ -70,23 +70,23 @@ List sessions:
7070

7171
```python
7272
>>> server.list_sessions()
73-
[Session($... libtmux_...), Session($... ...)]
73+
[Session($1 ...), Session($0 ...)]
7474
```
7575

7676
Find session:
7777

7878
```python
79-
>>> server.get_by_id('$0')
80-
Session($... ...)
79+
>>> server.get_by_id('$1')
80+
Session($1 ...)
8181
```
8282

8383
Find session by dict lookup:
8484

8585
```python
8686
>>> server.sessions[0].rename_session('foo')
87-
Session($... foo)
87+
Session($1 foo)
8888
>>> server.find_where({ "session_name": "foo" })
89-
Session($... foo)
89+
Session($1 foo)
9090
```
9191

9292
Control your session:
@@ -103,7 +103,7 @@ Create new window in the background (don't switch to it):
103103

104104
```python
105105
>>> session.new_window(attach=False, window_name="ha in the bg")
106-
Window(@... ...:ha in the bg, Session($... libtmux_...))
106+
Window(@2 ...:ha in the bg, Session($1 ...))
107107
```
108108

109109
Close window:
@@ -118,14 +118,14 @@ Grab remaining tmux window:
118118
```python
119119
>>> window = session.attached_window
120120
>>> window.split_window(attach=False)
121-
Pane(%... Window(@... ...:..., Session($... libtmux_...)))
121+
Pane(%2 Window(@1 ...:..., Session($1 ...)))
122122
```
123123

124124
Rename window:
125125

126126
```python
127127
>>> window.rename_window('libtmuxower')
128-
Window(@... ...:libtmuxower, Session($... ...))
128+
Window(@1 ...:libtmuxower, Session($1 ...))
129129
```
130130

131131
Split window (create a new pane):
@@ -134,13 +134,13 @@ Split window (create a new pane):
134134
>>> pane = window.split_window()
135135
>>> pane = window.split_window(attach=False)
136136
>>> pane.select_pane()
137-
Pane(%... Window(@... ...:..., Session($... libtmux_...)))
137+
Pane(%3 Window(@1 ...:..., Session($1 ...)))
138138
>>> window = session.new_window(attach=False, window_name="test")
139139
>>> window
140-
Window(@... ...:test, Session($...))
140+
Window(@2 2:test, Session($1 ...))
141141
>>> pane = window.split_window(attach=False)
142142
>>> pane
143-
Pane(%... Window(@... ...:..., Session($... libtmux_...)))
143+
Pane(%5 Window(@2 2:test, Session($1 ...)))
144144
```
145145

146146
Type inside the pane (send key strokes):
@@ -175,9 +175,9 @@ Traverse and navigate:
175175

176176
```python
177177
>>> pane.window
178-
Window(@... ...:..., Session($... ...))
178+
Window(@1 ...:..., Session($1 ...))
179179
>>> pane.window.session
180-
Session($... ...)
180+
Session($1 ...)
181181
```
182182

183183
# Python support

docs/quickstart.md

+14-14
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,15 @@ We can list sessions with {meth}`Server.list_sessions`:
139139

140140
```python
141141
>>> server.list_sessions()
142-
[Session($... ...), Session($... ...)]
142+
[Session($1 ...), Session($0 ...)]
143143
```
144144

145145
This returns a list of {class}`Session` objects you can grab. We can
146146
find our current session with:
147147

148148
```python
149149
>>> server.list_sessions()[0]
150-
Session($... ...)
150+
Session($1 ...)
151151
```
152152

153153
However, this isn't guaranteed, libtmux works against current tmux information, the
@@ -162,7 +162,7 @@ tmux sessions use the `$[0-9]` convention as a way to identify sessions.
162162

163163
```python
164164
>>> server.get_by_id('$1')
165-
Session($... ...)
165+
Session($1 ...)
166166
```
167167

168168
You may `session = server.get_by_id('$<yourId>')` to use the session object.
@@ -172,10 +172,10 @@ You may `session = server.get_by_id('$<yourId>')` to use the session object.
172172
```python
173173
# Just for setting up the example:
174174
>>> server.sessions[0].rename_session('foo')
175-
Session($... foo)
175+
Session($1 foo)
176176

177177
>>> server.find_where({ "session_name": "foo" })
178-
Session($... foo)
178+
Session($1 foo)
179179
```
180180

181181
With `find_where`, pass in a dict and return the first object found. In
@@ -188,11 +188,11 @@ So you may now use:
188188
```python
189189
# Prepping the example:
190190
>>> server.sessions[0].rename_session('foo')
191-
Session($... foo)
191+
Session($1 foo)
192192

193193
>>> session = server.find_where({ "session_name": "foo" })
194194
>>> session
195-
Session($... foo)
195+
Session($1 foo)
196196
```
197197

198198
to give us a `session` object to play with.
@@ -206,7 +206,7 @@ Let's make a {meth}`Session.new_window`, in the background:
206206

207207
```python
208208
>>> session.new_window(attach=False, window_name="ha in the bg")
209-
Window(@... ...:ha in the bg, Session($... ...))
209+
Window(@2 ...:ha in the bg, Session($1 ...))
210210
```
211211

212212
So a few things:
@@ -245,15 +245,15 @@ should have history, so navigate up with the arrow key.
245245

246246
```python
247247
>>> session.new_window(attach=False, window_name="ha in the bg")
248-
Window(@... ...:ha in the bg, Session($... ...))
248+
Window(@2 ...:ha in the bg, Session($1 ...))
249249
```
250250

251251
Try to kill the window by the matching id `@[0-9999]`.
252252

253253
```python
254254
# Setup
255255
>>> session.new_window(attach=False, window_name="ha in the bg")
256-
Window(@... ...:ha in the bg, Session($... ...))
256+
Window(@1 ...:ha in the bg, Session($1 ...))
257257

258258
>>> session.kill_window('ha in the bg')
259259
```
@@ -264,7 +264,7 @@ object:
264264
```python
265265
>>> window = session.new_window(attach=False, window_name="check this out")
266266
>>> window
267-
Window(@... ...:check this out, Session($... ...))
267+
Window(@2 2:check this out, Session($1 ...))
268268
```
269269

270270
And kill:
@@ -291,7 +291,7 @@ Let's create a pane, {meth}`Window.split_window`:
291291

292292
```python
293293
>>> window.split_window(attach=False)
294-
Pane(%... Window(@... ...:..., Session($... ...)))
294+
Pane(%2 Window(@1 ...:..., Session($1 ...)))
295295
```
296296

297297
Powered up. Let's have a break down:
@@ -304,7 +304,7 @@ Also, since you are aware of this power, let's commemorate the experience:
304304

305305
```python
306306
>>> window.rename_window('libtmuxower')
307-
Window(@... ...:..., Session($... ...))
307+
Window(@1 ...:..., Session($1 ...))
308308
```
309309

310310
You should have noticed {meth}`Window.rename_window` renamed the window.
@@ -329,7 +329,7 @@ can also use the `.select_*` available on the object, in this case the pane has
329329

330330
```python
331331
>>> pane.select_pane()
332-
Pane(%... Window(@... ...:..., Session($... ...)))
332+
Pane(%1 Window(@1 ...:..., Session($1 ...)))
333333
```
334334

335335
```{eval-rst}

docs/reference/properties.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Get the {class}`~libtmux.Session` object:
4343
```python
4444
>>> session = server.sessions[0]
4545
>>> session
46-
Session($... libtmux_...)
46+
Session($1 libtmux_...)
4747
```
4848

4949
Quick access to basic attributes:
@@ -53,7 +53,7 @@ Quick access to basic attributes:
5353
'libtmux_...'
5454

5555
>>> session.id
56-
'$...'
56+
'$1'
5757
```
5858

5959
To see all attributes for a session:
@@ -79,7 +79,7 @@ The same concepts apply for {class}`~libtmux.Window`:
7979
>>> window = session.attached_window
8080

8181
>>> window
82-
Window(@... ...:..., Session($... ...))
82+
Window(@1 ...:..., Session($1 ...))
8383
```
8484

8585
Basics:
@@ -89,7 +89,7 @@ Basics:
8989
'...'
9090

9191
>>> window.id
92-
'@...'
92+
'@1'
9393

9494
>>> window.height
9595
'...'
@@ -120,7 +120,7 @@ Get the {class}`~libtmux.Pane`:
120120
>>> pane = window.attached_pane
121121

122122
>>> pane
123-
Pane(%... Window(@... ...:..., Session($... libtmux_...)))
123+
Pane(%1 Window(@1 ...:..., Session($1 libtmux_...)))
124124
```
125125

126126
Basics:

docs/topics/traversal.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -42,44 +42,44 @@ Get first session {class}`~libtmux.Session` to `session`:
4242
```python
4343
>>> session = server.sessions[0]
4444
>>> session
45-
Session($... ...)
45+
Session($1 ...)
4646
```
4747

4848
Get a list of sessions:
4949

5050
```python
5151
>>> server.sessions
52-
[Session($... ...), Session($... ...)]
52+
[Session($1 ...), Session($0 ...)]
5353
```
5454

5555
Iterate through sessions in a server:
5656

5757
```python
5858
>>> for sess in server.sessions:
5959
... print(sess)
60-
Session($... ...)
61-
Session($... ...)
60+
Session($1 ...)
61+
Session($0 ...)
6262
```
6363

6464
Grab a {class}`~libtmux.Window` from a session:
6565

6666
```python
6767
>>> session.windows[0]
68-
Window(@... ...:..., Session($... ...))
68+
Window(@1 ...:..., Session($1 ...))
6969
```
7070

7171
Grab the currently focused window from session:
7272

7373
```python
7474
>>> session.attached_window
75-
Window(@... ...:..., Session($... ...))
75+
Window(@1 ...:..., Session($1 ...))
7676
```
7777

7878
Grab the currently focused {class}`Pane` from session:
7979

8080
```python
8181
>>> session.attached_pane
82-
Pane(%... Window(@... ...:..., Session($... ...)))
82+
Pane(%1 Window(@1 ...:..., Session($1 ...)))
8383
```
8484

8585
Assign the attached {class}`~libtmux.Pane` to `p`:
@@ -93,7 +93,7 @@ Access the window/server of a pane:
9393
```python
9494
>>> p = session.attached_pane
9595
>>> p.window
96-
Window(@... ...:..., Session($... ...))
96+
Window(@1 ...:..., Session($1 ...))
9797

9898
>>> p.server
9999
<libtmux.server.Server object at ...>

0 commit comments

Comments
 (0)