-
Notifications
You must be signed in to change notification settings - Fork 23
Allow a default to be specified for boolean flags #41
Conversation
This allows the use of boolean flag symantecs where the default behavior for the application is as if `--flag` had been passed, and `--no-flag` is not the default behavoir.
Thanks for the contribution! Before we can merge this, we need @rhwood to sign the Salesforce.com Contributor License Agreement. |
Codecov Report
@@ Coverage Diff @@
## master #41 +/- ##
=======================================
Coverage 90.39% 90.39%
=======================================
Files 11 11
Lines 302 302
Branches 80 80
=======================================
Hits 273 273
Misses 10 10
Partials 19 19
Continue to review full report at Codecov.
|
I touched on this in #34 but I'm not convinced this is very useful though. can you provide a real-world example of where you would want a default for a boolean flag? |
I want to be able to make the (primary or only) flag be In my specific case, I have a tool that manages a server normally run as a daemon (i.e. detached from the console and parent process), but if a user wants to run the server as not a daemon, I want the user to use the What I would really like to be able to do is have this code when writing the flags:
so that when later checking if the server should be a daemon, I can simply use |
ah I see, I think this makes sense. I appreciate the explanation. At some point I'd like to hook this together with some sort of configuration utility to make this even more hands-off so you could do what you're doing with less code. |
# [3.7.0](v3.6.3...v3.7.0) (2018-10-17) ### Features * Allow a default to be specified for boolean flags ([#41](#41)) ([f5053a5](f5053a5))
🎉 This PR is included in version 3.7.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This allows the use of boolean flag semantics where the default behavior for the application is as if
--flag
had been passed, and--no-flag
is not the default behavior.