Skip to content

Commit

Permalink
docs: Cleanup for command examples
Browse files Browse the repository at this point in the history
  • Loading branch information
tony committed Feb 17, 2024
1 parent 915fd19 commit 8baa764
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ New session:
'libtmux...:2.0'
```

Time for some tech, direct to a rich, `Window` object:
From raw command output, to a rich `Window` object (in practice and as shown
later, you'd use `Session.new_window()`):

```python
>>> Window.from_window_id(window_id=session.cmd('new-window', '-P', '-F#{window_id}').stdout[0], server=session.server)
Expand All @@ -102,10 +103,10 @@ Create a pane from a window:
'%2'
```

Magic, directly to a `Pane`:
Raw output directly to a `Pane`:

```python
>>> Pane.from_pane_id(pane_id=session.cmd('split-window', '-P', '-F#{pane_id}').stdout[0], server=session.server)
>>> Pane.from_pane_id(pane_id=window.cmd('split-window', '-P', '-F#{pane_id}').stdout[0], server=window.server)
Pane(%... Window(@1 1:..., Session($1 libtmux_...)))
```

Expand All @@ -130,7 +131,7 @@ Direct lookup:
Session($1 ...)
```

Filter sesions:
Filter sessions:

```python
>>> server.sessions[0].rename_session('foo')
Expand Down
7 changes: 4 additions & 3 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ New session:
'libtmux...:2.0'
```

Time for some tech, direct to a rich, `Window` object:
From raw command output, to a rich {class}`Window` object (in practice and as shown
later, you'd use {meth}`Session.new_window()`):

```python
>>> Window.from_window_id(window_id=session.cmd('new-window', '-P', '-F#{window_id}').stdout[0], server=session.server)
Expand All @@ -148,10 +149,10 @@ Create a pane from a window:
'%2'
```

Magic, directly to a `Pane`:
Raw output directly to a {class}`Pane` (in practice, you'd use {meth}`Window.split_window()`):

```python
>>> Pane.from_pane_id(pane_id=session.cmd('split-window', '-P', '-F#{pane_id}').stdout[0], server=session.server)
>>> Pane.from_pane_id(pane_id=window.cmd('split-window', '-P', '-F#{pane_id}').stdout[0], server=window.server)
Pane(%... Window(@1 1:..., Session($1 libtmux_...)))
```

Expand Down
8 changes: 4 additions & 4 deletions src/libtmux/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def cmd(self, cmd: str, *args: t.Any) -> tmux_cmd:
>>> session.cmd('new-window', '-P').stdout[0]
'libtmux...:2.0'
Time for some tech, direct to a rich, `Window` object:
Output of `tmux -L ... new-window -P -F#{window_id}` to a `Window` object:
>>> Window.from_window_id(window_id=session.cmd(
... 'new-window', '-P', '-F#{window_id}').stdout[0], server=session.server)
Expand All @@ -200,10 +200,10 @@ def cmd(self, cmd: str, *args: t.Any) -> tmux_cmd:
>>> window.cmd('split-window', '-P', '-F#{pane_id}').stdout[0]
'%5'
Magic, directly to a `Pane`:
Output of `tmux -L ... split-window -P -F#{pane_id}` to a `Pane` object:
>>> Pane.from_pane_id(pane_id=session.cmd(
... 'split-window', '-P', '-F#{pane_id}').stdout[0], server=session.server)
>>> Pane.from_pane_id(pane_id=window.cmd(
... 'split-window', '-P', '-F#{pane_id}').stdout[0], server=window.server)
Pane(%... Window(@... ...:..., Session($1 libtmux_...)))
Returns
Expand Down

0 comments on commit 8baa764

Please sign in to comment.