Skip to content

Commit 5635b4b

Browse files
authored
docs: Improve command formatting (#644)
why: Standardize shell code blocks to follow documentation guidelines what: - Use `console` language tag with `$ ` prefix for shell commands - One command per code block for copyability - Split long pipx install command with `\` line continuations - Add Shell Command Formatting rules to AGENTS.md
1 parent d841b39 commit 5635b4b

File tree

5 files changed

+90
-20
lines changed

5 files changed

+90
-20
lines changed

AGENTS.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ EOF
436436

437437
When writing documentation (README, CHANGES, docs/), follow these rules for code blocks:
438438

439-
**One command per code block.** This makes commands individually copyable.
439+
**One command per code block.** This makes commands individually copyable. For sequential commands, either use separate code blocks or chain them with `&&` or `;` and `\` continuations (keeping it one logical command).
440440

441441
**Put explanations outside the code block**, not as comments inside.
442442

@@ -464,6 +464,42 @@ $ uv run pytest
464464
$ uv run pytest --cov
465465
```
466466

467+
### Shell Command Formatting
468+
469+
These rules apply to shell commands in documentation (README, CHANGES, docs/), **not** to Python doctests.
470+
471+
**Use `console` language tag with `$ ` prefix.** This distinguishes interactive commands from scripts and enables prompt-aware copy in many terminals.
472+
473+
Good:
474+
475+
```console
476+
$ uv run pytest
477+
```
478+
479+
Bad:
480+
481+
```bash
482+
uv run pytest
483+
```
484+
485+
**Split long commands with `\` for readability.** Each flag or flag+value pair gets its own continuation line, indented. Positional parameters go on the final line.
486+
487+
Good:
488+
489+
```console
490+
$ pipx install \
491+
--suffix=@next \
492+
--pip-args '\--pre' \
493+
--force \
494+
'libtmux'
495+
```
496+
497+
Bad:
498+
499+
```console
500+
$ pipx install --suffix=@next --pip-args '\--pre' --force 'libtmux'
501+
```
502+
467503
## Debugging Tips
468504

469505
When stuck in debugging loops:

CHANGES

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,11 @@ $ pip install --user --upgrade --pre libtmux
1212
[pipx](https://pypa.github.io/pipx/docs/):
1313

1414
```console
15-
$ pipx install --suffix=@next 'libtmux' --pip-args '\--pre' --force
15+
$ pipx install \
16+
--suffix=@next \
17+
--pip-args '\--pre' \
18+
--force \
19+
'libtmux'
1620
// Usage: libtmux@next [command]
1721
```
1822

README.md

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,27 +41,30 @@ Maintenance-only backports (no new fixes):
4141

4242
Stable release:
4343

44-
```bash
45-
pip install libtmux
44+
```console
45+
$ pip install libtmux
4646
```
4747

4848
With pipx:
4949

50-
```bash
51-
pipx install libtmux
50+
```console
51+
$ pipx install libtmux
5252
```
5353

5454
With uv / uvx:
5555

56-
```bash
57-
uv add libtmux
58-
uvx --from "libtmux" python
56+
```console
57+
$ uv add libtmux
58+
```
59+
60+
```console
61+
$ uvx --from "libtmux" python
5962
```
6063

6164
From the main branch (bleeding edge):
6265

63-
```bash
64-
pip install 'git+https://github.com/tmux-python/libtmux.git'
66+
```console
67+
$ pip install 'git+https://github.com/tmux-python/libtmux.git'
6568
```
6669

6770
Tip: libtmux is pre-1.0. Pin a range in projects to avoid surprises:
@@ -94,6 +97,9 @@ Use [ptpython], [ipython], etc. for a nice REPL with autocompletions:
9497

9598
```console
9699
$ pip install --user ptpython
100+
```
101+
102+
```console
97103
$ ptpython
98104
```
99105

docs/developing.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ $ make start
7373
### Manual documentation (the hard way)
7474

7575
```console
76-
$ cd docs/
77-
$ make html
76+
$ cd docs/ && make html
7877
```
7978

8079
to build.
@@ -86,8 +85,16 @@ $ make serve
8685
to start http server.
8786

8887
Helpers:
88+
89+
Build docs:
90+
8991
```console
9092
$ make build_docs
93+
```
94+
95+
Serve docs:
96+
97+
```console
9198
$ make serve_docs
9299
```
93100

@@ -278,10 +285,19 @@ building, and publishing. Therefore there is no setup.py or requirements files.
278285
Update `__version__` in `__about__.py` and `pyproject.toml`:
279286

280287
```console
281-
git commit -m 'build(libtmux): Tag v0.1.1'
282-
git tag v0.1.1
283-
git push
284-
git push --tags
288+
$ git commit -m 'build(libtmux): Tag v0.1.1'
289+
```
290+
291+
```console
292+
$ git tag v0.1.1
293+
```
294+
295+
```console
296+
$ git push
297+
```
298+
299+
```console
300+
$ git push --tags
285301
```
286302

287303
[twine]: https://twine.readthedocs.io/

docs/quickstart.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,15 @@ the 4th beta release of `1.10.0` before general availability.
4444
- [pipx]\:
4545

4646
```console
47-
$ pipx install --suffix=@next 'libtmux' --pip-args '\--pre' --force
48-
// Usage: libtmux@next [command]
47+
$ pipx install \
48+
--suffix=@next \
49+
--pip-args '\--pre' \
50+
--force \
51+
'libtmux'
4952
```
5053

54+
Usage: `libtmux@next [command]`
55+
5156
- [uv tool install][uv-tools]\:
5257

5358
```console
@@ -77,7 +82,10 @@ via trunk (can break easily):
7782
- [pipx]\:
7883

7984
```console
80-
$ pipx install --suffix=@master 'libtmux @ git+https://github.com/tmux-python/libtmux.git@master' --force
85+
$ pipx install \
86+
--suffix=@master \
87+
--force \
88+
'libtmux @ git+https://github.com/tmux-python/libtmux.git@master'
8189
```
8290

8391
- [uv]\:

0 commit comments

Comments
 (0)