Skip to content

Fix option matching across placeholder boundaries - #378

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

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

Conversation

@monster437

Copy link
Copy Markdown

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.

Replaces #377, which was automatically closed when the source fork was deleted. The source fork has been recreated; the implementation and commit are unchanged.

This branch has not been deployed

No deployments
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