Skip to content

Fix option matching across placeholder boundaries - #377

Closed
monster437 wants to merge 1 commit into
tldr-pages:mainfrom
monster437:fix/345-option-placeholder-boundaries
Closed

monster437 wants to merge 1 commit into
tldr-pages:mainfrom
monster437:fix/345-option-placeholder-boundaries

Conversation

@monster437

@monster437 monster437 commented Nov 15, 2026 •

Copy link
Copy Markdown

Continued in #378 after recreating the accidentally deleted source fork.

Selecting short or long options can consume neighboring placeholders and corrupt an otherwise valid command example. For the example in #345, long-option mode drops '[FL FR]' entirely, while short-option mode leaves stray braces and brackets.

Restrict both option-matching expressions to the current placeholder by excluding { and } from their contents. The example now renders as:

short: pw-loopback -m '[FL FR]' -i 'media.class=Audio/Sink'
long:  pw-loopback --channel-map '[FL FR]' --capture-props 'media.class=Audio/Sink'

Add six parameterized regression cases covering the reported command and escaped option-like placeholders in short, long, and both modes. The two reported short/long cases fail on the original code and pass with this fix.

Fixes #345.

Validation on Windows with Python 3.11.9:

  • python -m pytest tests/ -q: 40 passed (with the environment's NO_COLOR unset for the existing color snapshots).
  • python -m flake8 --extend-exclude .venv: passed.
  • git diff --check: passed.
  • Sphinx manpage build: passed.
  • Source distribution and wheel build: passed.
  • Installed-wheel CLI checks in an isolated environment: short, long, both, and default modes all passed.

AI assistance: Codex implemented and tested this change.

Upstream CI has not executed any test jobs. The workflow run reports: "This workflow run required approval but was not approved before it expired." A maintainer will need to approve/re-run the workflow; the local validation results are listed above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rendering issue

1 participant