Skip to content

Fix option matching across placeholder boundaries - #376

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

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

Conversation

@monster4567

@monster4567 monster4567 commented Nov 15, 2026 •

Copy link
Copy Markdown

Superseded by #377, submitted from the contributor's intended account (monster437).

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. This PR is a draft pending the contributor's review.

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

2 participants