Skip to content

Commit b7b72d9

Browse files
authored
docs: Improve command formatting (#535)
why: Standardize shell code blocks to follow documentation guidelines what: - Use `console` language tag with `$ ` prefix for shell commands - Split long pipx install command with `\` line continuations - Split long jq pipe commands in README.md and docs/cli/status.md - Add Shell Command Formatting rules to AGENTS.md
1 parent b8f81d3 commit b7b72d9

5 files changed

Lines changed: 62 additions & 17 deletions

File tree

AGENTS.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ what:
401401

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

404-
**One command per code block.** This makes commands individually copyable.
404+
**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).
405405

406406
**Put explanations outside the code block**, not as comments inside.
407407

@@ -429,6 +429,42 @@ $ vcspull search django
429429
$ vcspull search "name:flask"
430430
```
431431

432+
### Shell Command Formatting
433+
434+
These rules apply to shell commands in documentation (README, CHANGES, docs/), **not** to Python doctests.
435+
436+
**Use `console` language tag with `$ ` prefix.** This distinguishes interactive commands from scripts and enables prompt-aware copy in many terminals.
437+
438+
Good:
439+
440+
```console
441+
$ uv run pytest
442+
```
443+
444+
Bad:
445+
446+
```bash
447+
uv run pytest
448+
```
449+
450+
**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.
451+
452+
Good:
453+
454+
```console
455+
$ pipx install \
456+
--suffix=@next \
457+
--pip-args '\--pre' \
458+
--force \
459+
'vcspull'
460+
```
461+
462+
Bad:
463+
464+
```console
465+
$ pipx install --suffix=@next --pip-args '\--pre' --force 'vcspull'
466+
```
467+
432468
**Prefer longform flags** — use `--workspace` not `-w`, `--file` not `-f`.
433469

434470
**Split multi-flag commands** — when a command has 2+ flags/options, place each on its own `\`-continuation line, indented by 4 spaces.

CHANGES

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ $ pip install --user --upgrade --pre vcspull
1111
[pipx](https://pypa.github.io/pipx/docs/):
1212

1313
```console
14-
$ pipx install --suffix=@next 'vcspull' --pip-args '\--pre' --force
14+
$ pipx install \
15+
--suffix=@next \
16+
--pip-args '\--pre' \
17+
--force \
18+
'vcspull'
1519
// Usage: vcspull@next sync [config]
1620
```
1721

@@ -948,7 +952,7 @@ This release modernizes the vcspull CLI to align with DevOps tool conventions (T
948952

949953
#### Migration Guide (#472)
950954

951-
```bash
955+
```
952956
# Old → New
953957
vcspull import NAME URL → vcspull add NAME URL
954958
vcspull import --scan DIR → vcspull discover DIR
@@ -1157,14 +1161,14 @@ _Maintenance only, no bug fixes or new features_
11571161

11581162
via ruff v0.3.4, all automated lint fixes, including unsafe and previews were applied:
11591163

1160-
```sh
1161-
ruff check --select ALL . --fix --unsafe-fixes --preview --show-fixes; ruff format .
1164+
```console
1165+
$ ruff check --select ALL . --fix --unsafe-fixes --preview --show-fixes; ruff format .
11621166
```
11631167

11641168
Branches were treated with:
11651169

1166-
```sh
1167-
git rebase \
1170+
```console
1171+
$ git rebase \
11681172
--strategy-option=theirs \
11691173
--exec 'poetry run ruff check --select ALL . --fix --unsafe-fixes --preview --show-fixes; poetry run ruff format .; git add src tests; git commit --amend --no-edit' \
11701174
origin/master

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,8 @@ for CI/CD:
208208
$ vcspull sync --dry-run "*"
209209
$ vcspull sync --dry-run --show-unchanged "workspace-*"
210210
$ vcspull sync --dry-run --json "*" | jq '.summary'
211-
$ vcspull sync --dry-run --ndjson "*" | jq --slurp 'map(select(.type == "summary"))'
211+
$ vcspull sync --dry-run --ndjson "*" \
212+
| jq --slurp 'map(select(.type == "summary"))'
212213
```
213214

214215
Dry runs stream a progress line when stdout is a TTY, then print a concise plan

docs/cli/completion.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,26 +32,26 @@ $ uvx shtab
3232

3333
:::{tab} bash
3434

35-
```bash
36-
shtab --shell=bash -u vcspull.cli.create_parser \
35+
```console
36+
$ shtab --shell=bash -u vcspull.cli.create_parser \
3737
| sudo tee "$BASH_COMPLETION_COMPAT_DIR"/VCSPULL
3838
```
3939

4040
:::
4141

4242
:::{tab} zsh
4343

44-
```zsh
45-
shtab --shell=zsh -u vcspull.cli.create_parser \
44+
```console
45+
$ shtab --shell=zsh -u vcspull.cli.create_parser \
4646
| sudo tee /usr/local/share/zsh/site-functions/_VCSPULL
4747
```
4848

4949
:::
5050

5151
:::{tab} tcsh
5252

53-
```zsh
54-
shtab --shell=tcsh -u vcspull.cli.create_parser \
53+
```console
54+
$ shtab --shell=tcsh -u vcspull.cli.create_parser \
5555
| sudo tee /etc/profile.d/VCSPULL.completion.csh
5656
```
5757

docs/cli/status.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ Each status entry includes:
129129
Filter with [jq] to find missing repositories:
130130

131131
```console
132-
$ vcspull status --json | jq '.[] | select(.reason == "status" and .exists == false)'
132+
$ vcspull status --json \
133+
| jq '.[] | select(.reason == "status" and .exists == false)'
133134
```
134135

135136
Or extract just the summary:
@@ -160,13 +161,16 @@ $ vcspull status --ndjson | grep '"exists":false' | jq -r '.name'
160161
Monitor missing repositories:
161162

162163
```console
163-
$ vcspull status --json | jq -r '.[] | select(.reason == "status" and .exists == false) | .name'
164+
$ vcspull status --json \
165+
| jq -r '.[] | select(.reason == "status" and .exists == false) | .name'
164166
```
165167

166168
Check which repositories need syncing:
167169

168170
```console
169-
$ vcspull status --json | jq -r '.[] | select(.reason == "status" and .exists == false) | .name' | xargs vcspull sync
171+
$ vcspull status --json \
172+
| jq -r '.[] | select(.reason == "status" and .exists == false) | .name' \
173+
| xargs vcspull sync
170174
```
171175

172176
Generate reports:

0 commit comments

Comments
 (0)