@@ -258,32 +258,48 @@ async def acmd(
258
258
259
259
Examples
260
260
--------
261
- >>> server.acmd('display-message', 'hi')
262
- <libtmux.common.AsyncTmuxCmd object at ...>
261
+ >>> import asyncio
262
+ >>> server = Server(socket_name="test")
263
+ >>> async def test_acmd():
264
+ ... result = await server.acmd('display-message', 'hi')
265
+ ... print(result.stdout)
266
+ >>> asyncio.run(test_acmd())
267
+ []
263
268
264
269
New session:
265
270
266
- >>> server.acmd('new-session', '-d', '-P', '-F#{session_id}').stdout[0]
267
- '$2'
268
-
269
- >>> session.acmd('new-window', '-P').stdout[0]
270
- 'libtmux ...:2.0'
271
+ >>> async def test_new_session():
272
+ ... result = await server.acmd('new-session', '-d', '-P', '-F#{session_id}')
273
+ ... print(result.stdout[0])
274
+ >>> asyncio.run(test_new_session())
275
+ $ ...
271
276
272
277
Output of `tmux -L ... new-window -P -F#{window_id}` to a `Window` object:
273
278
274
- >>> Window.from_window_id(window_id=await session.acmd(
275
- ... 'new-window', '-P', '-F#{window_id}').stdout[0], server=session.server)
276
- Window(@4 3:..., Session($1 libtmux_...))
279
+ >>> async def test_new_window():
280
+ ... result = await server.acmd('new-window', '-P', '-F#{window_id}')
281
+ ... window_id = result.stdout[0]
282
+ ... window = Window.from_window_id(window_id=window_id, server=server)
283
+ ... print(window)
284
+ >>> asyncio.run(test_new_window())
285
+ Window(@... ...:..., Session($... libtmux_...))
277
286
278
287
Create a pane from a window:
279
288
280
- >>> window.acmd('split-window', '-P', '-F#{pane_id}').stdout[0]
281
- '%5'
289
+ >>> async def test_split_window():
290
+ ... result = await server.acmd('split-window', '-P', '-F#{pane_id}')
291
+ ... print(result.stdout[0])
292
+ >>> asyncio.run(test_split_window())
293
+ %...
282
294
283
295
Output of `tmux -L ... split-window -P -F#{pane_id}` to a `Pane` object:
284
296
285
- >>> Pane.from_pane_id(pane_id=window.cmd(
286
- ... 'split-window', '-P', '-F#{pane_id}').stdout[0], server=window.server)
297
+ >>> async def test_pane():
298
+ ... result = await server.acmd('split-window', '-P', '-F#{pane_id}')
299
+ ... pane_id = result.stdout[0]
300
+ ... pane = Pane.from_pane_id(pane_id=pane_id, server=server)
301
+ ... print(pane)
302
+ >>> asyncio.run(test_pane())
287
303
Pane(%... Window(@... ...:..., Session($1 libtmux_...)))
288
304
289
305
Parameters
0 commit comments