feat: make environment flag parsing consistent with click#4443
feat: make environment flag parsing consistent with click#4443provinzkraut merged 13 commits intolitestar-org:mainfrom
click#4443Conversation
Also add a new utility function: - envflag(): parses environment variables as boolean Applied envflag() to read some environment variables
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4443 +/- ##
==========================================
+ Coverage 97.83% 97.85% +0.01%
==========================================
Files 297 297
Lines 15321 15336 +15
Branches 1716 1720 +4
==========================================
+ Hits 14990 15007 +17
+ Misses 189 188 -1
+ Partials 142 141 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
click
|
Documentation preview will be available shortly at https://litestar-org.github.io/litestar-docs-preview/4443 |
* envflag: removed default parameter. * envflag: behavior now matches click.BoolParamType. * envflag: raises an error if none of the conditions are met. * tests(envflag): updated tests and applied monkeypatch.
|
@provinzkraut I’m currently using |
|
Looks like you need to adjust the code to reflect the new default behaviour |
- Set default=True for warning flags to keep them enabled by default - Remove redundant bool() cast for quiet_console flag - Add test for envflag() with default=True parameter
Yes, you’re right. I’ve made the changes. |
Description
As mentioned in the issue, handling environment variables is currently inconsistent.
This PR aims to address this by using Click for a more consistent solution:
--quiet-consoleflag to controlLITESTAR_QUIET_CONSOLE.envflag(), which returns True for1,true,t,yes,on,y, and False otherwise.envflag()wherever CLI or other code reads environment variables representing flags.Closes