Skip to content

feat: enhance boolean parsing for environment variables #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

michelhe
Copy link

@michelhe michelhe commented Apr 28, 2025

Add support for common boolean representations in environment variables beyond the standard Rust bool parsing. Now accepts various forms like:

  • True values: "y", "yes", "t", "true", "on", "1"
  • False values: "n", "no", "f", "false", "off", "0"

This makes the library more user-friendly and aligns with common expectations for environment variable configuration. Implementation draws inspiration from clap_builder and python-humanfriendly.

What did you implement:

Closes: #xxx

How did you verify your change:

Added tests for both success and error cases

What (if anything) would need to be called out in the CHANGELOG for the next release:

Add support for common boolean representations in environment variables beyond the standard Rust bool parsing. Now accepts various forms like:

  • True values: "y", "yes", "t", "true", "on", "1"
  • False values: "n", "no", "f", "false", "off", "0", ""

@michelhe michelhe force-pushed the improve-boolean branch 4 times, most recently from 29801d8 to c453db1 Compare April 29, 2025 07:44
Add support for common boolean representations in environment variables
beyond the standard Rust bool parsing. Now accepts various forms like:
- True values: "y", "yes", "t", "true", "on", "1"
- False values: "n", "no", "f", "false", "off", "0", ""

This makes the library more user-friendly and aligns with common
expectations for environment variable configuration. Implementation
draws inspiration from clap_builder and python-humanfriendly.

Signed-off-by: Michel Heily <[email protected]>
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.

1 participant