Skip to content

Convert CLI provided strings to booleans for boolean config variables#2029

Merged
jensens merged 6 commits intocookiecutter:mainfrom
tylermilner:fix/1973_convert-context-string-to-boolean
Mar 25, 2024
Merged

Convert CLI provided strings to booleans for boolean config variables#2029
jensens merged 6 commits intocookiecutter:mainfrom
tylermilner:fix/1973_convert-context-string-to-boolean

Conversation

@tylermilner
Copy link
Copy Markdown
Contributor

Fixes #1973 - a bug where the override value provided via command line wasn't being properly converted to its boolean counterpart.

Since override values from the command line are interpreted as strings, we need to convert the override value to a boolean if it's overriding a boolean variable.

I'm a total Python newbie so please let me know if there's anything I can change to make this better.

tylermilner and others added 6 commits March 5, 2024 23:54
…cutter#1973)

Fixes a bug where the override value provided via command line wasn't being properly converted to its boolean counterpart.

Since override values from the command line are interpreted as strings, we need to convert the string value to a boolean if the config variable is a boolean to begin with.
@jensens jensens added the bug This issue/PR relates to a bug. label Mar 25, 2024
@jensens jensens changed the title fix: convert strings to booleans for boolean config variables (#1973) Convert CLI provided strings to booleans for boolean config variables Mar 25, 2024
@jensens jensens merged commit 7abf35f into cookiecutter:main Mar 25, 2024
@jensens
Copy link
Copy Markdown
Contributor

jensens commented Mar 25, 2024

Thanks!

@jaap3
Copy link
Copy Markdown

jaap3 commented Jun 12, 2024

Would love a release with this fix. Just noticed our CI is not actually testing what I thought it was because of this issue

@jensens
Copy link
Copy Markdown
Contributor

jensens commented Jun 12, 2024

You are right, it is time for a release. I'll put it on my todo list for the next days! Thanks for the reminder!

@jaap3
Copy link
Copy Markdown

jaap3 commented Jun 13, 2024

@jensens thanks! Was able to work around it with a pre-generate hook, so no rush 😉

@scprek
Copy link
Copy Markdown

scprek commented Nov 1, 2024

Looks like 2.6.0 was in February, this to me seems like a fix release? What's the hold up here?

@alexdewar
Copy link
Copy Markdown

This would be a nice feature to have in a release version of cookiecutter... I've just spent some time debugging this on a project of my own.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug This issue/PR relates to a bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot properly override boolean variable from command line

5 participants