Skip to content

Add --mask-pattern option to the qr command line script - #433

Open
ChrisJr404 wants to merge 1 commit into
lincolnloop:mainfrom
ChrisJr404:cli-mask-pattern
Open

Add --mask-pattern option to the qr command line script#433
ChrisJr404 wants to merge 1 commit into
lincolnloop:mainfrom
ChrisJr404:cli-mask-pattern

Conversation

@ChrisJr404

Copy link
Copy Markdown

The QRCode class already takes a mask_pattern argument, but the qr script had no way to pass it through, so it always used the automatically chosen best-scoring pattern. This adds a --mask-pattern option 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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant