Add --mask-pattern option to the qr command line script - #433
Open
ChrisJr404 wants to merge 1 commit into
Open
Conversation
The QRCode class already accepts a mask_pattern argument, but there was no way to set it from the qr script, so the command always relied on the automatically chosen best pattern. Expose it as --mask-pattern so callers can pin a specific pattern (0-7), and surface an out-of-range value as a normal parser error instead of a traceback. Closes lincolnloop#335.
ChrisJr404
force-pushed
the
cli-mask-pattern
branch
from
August 18, 2026 23:40
42a1370 to
96b9b73
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The QRCode class already takes a
mask_patternargument, but theqrscript had no way to pass it through, so it always used the automatically chosen best-scoring pattern. This adds a--mask-patternoption that lets you pin a specific pattern (0-7) from the command line, which is handy for reproducible output and for testing/inspecting how the different masks look.When the value is omitted the behavior is unchanged (the pattern is still chosen automatically), and an out-of-range value is reported as a normal
qr: error: ...message rather than a traceback, matching how the other option errors are handled.Added CLI tests for the applied pattern, the default, and the out-of-range case, and documented the option in the man page and changelog.
Closes #335.