Skip to content

Commit a19a9f0

Browse files
committed
Server.acmd: WIP
1 parent df7df77 commit a19a9f0

File tree

1 file changed

+29
-14
lines changed

1 file changed

+29
-14
lines changed

src/libtmux/server.py

Lines changed: 29 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -258,32 +258,47 @@ async def acmd(
258258
259259
Examples
260260
--------
261-
>>> server.acmd('display-message', 'hi')
262-
<libtmux.common.AsyncTmuxCmd object at ...>
261+
>>> import asyncio
262+
>>> async def test_acmd():
263+
... result = await server.acmd('display-message', 'hi')
264+
... print(result.stdout)
265+
>>> asyncio.run(test_acmd())
266+
[]
263267
264268
New session:
265269
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'
270+
>>> async def test_new_session():
271+
... result = await server.acmd('new-session', '-d', '-P', '-F#{session_id}')
272+
... print(result.stdout[0])
273+
>>> asyncio.run(test_new_session())
274+
$...
271275
272276
Output of `tmux -L ... new-window -P -F#{window_id}` to a `Window` object:
273277
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_...))
278+
>>> async def test_new_window():
279+
... result = await server.acmd('new-window', '-P', '-F#{window_id}')
280+
... window_id = result.stdout[0]
281+
... window = Window.from_window_id(window_id=window_id, server=server)
282+
... print(window)
283+
>>> asyncio.run(test_new_window())
284+
Window(@... ...:..., Session($... libtmux_...))
277285
278286
Create a pane from a window:
279287
280-
>>> window.acmd('split-window', '-P', '-F#{pane_id}').stdout[0]
281-
'%5'
288+
>>> async def test_split_window():
289+
... result = await server.acmd('split-window', '-P', '-F#{pane_id}')
290+
... print(result.stdout[0])
291+
>>> asyncio.run(test_split_window())
292+
%...
282293
283294
Output of `tmux -L ... split-window -P -F#{pane_id}` to a `Pane` object:
284295
285-
>>> Pane.from_pane_id(pane_id=window.cmd(
286-
... 'split-window', '-P', '-F#{pane_id}').stdout[0], server=window.server)
296+
>>> async def test_pane():
297+
... result = await server.acmd('split-window', '-P', '-F#{pane_id}')
298+
... pane_id = result.stdout[0]
299+
... pane = Pane.from_pane_id(pane_id=pane_id, server=server)
300+
... print(pane)
301+
>>> asyncio.run(test_pane())
287302
Pane(%... Window(@... ...:..., Session($1 libtmux_...)))
288303
289304
Parameters

0 commit comments

Comments
 (0)