Skip to content

Pass --regex-pattern through to slugify() from the CLI#184

Open
eeshsaxena wants to merge 1 commit into
un33k:masterfrom
eeshsaxena:fix-cli-regex-pattern
Open

Pass --regex-pattern through to slugify() from the CLI#184
eeshsaxena wants to merge 1 commit into
un33k:masterfrom
eeshsaxena:fix-cli-regex-pattern

Conversation

@eeshsaxena

Copy link
Copy Markdown

Fixes #175.

slugify_params() in slugify/__main__.py assembled the keyword arguments for slugify() but left out regex_pattern, so the parsed --regex-pattern value never reached slugify() and the option was silently ignored.

Before

$ slugify --regex-pattern "[^-a-z0-9_]+" "___This is a test___"
this-is-a-test

After

$ slugify --regex-pattern "[^-a-z0-9_]+" "___This is a test___"
___this-is-a-test___

Added regex_pattern to the CLI DEFAULTS and a test_regex_pattern case that checks both the parsed params and that the pattern actually reaches slugify(). Full suite: 83 passed.

slugify_params() built the kwargs for slugify() but omitted regex_pattern,
so the CLI silently ignored --regex-pattern. Wire it through and add a
CLI test.

Fixes un33k#175
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.

--regex-pattern option ignored by CLI

1 participant