You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/options.md
+7-2Lines changed: 7 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -257,8 +257,7 @@ Boolean options (boolean flags) take the value True or False. The simplest case
257
257
258
258
```
259
259
260
-
To implement this more explicitly, pass in on-option `/` off-option. Click will automatically set `is_flag=True`. Click always wants you to provide an enable
261
-
and disable flag so that you can change the default later.
260
+
To implement this more explicitly, pass in on-option `/` off-option. Click will automatically set `is_flag=True`.
262
261
263
262
```{eval-rst}
264
263
.. click:example::
@@ -280,6 +279,12 @@ and disable flag so that you can change the default later.
280
279
invoke(info, args=['--no-shout'])
281
280
```
282
281
282
+
Use cases for this more explicit pattern include:
283
+
284
+
* The default can be dynamic so the user can explicitly specify the option with either on or off option, or pass in no option to use the dynamic default.
285
+
* Shell scripts sometimes want to be explicit even when it's the default
286
+
* Shell aliases can set a flag, then an invocation can add a negation of the flag
287
+
283
288
If a forward slash(`/`) is contained in your option name already, you can split the parameters using `;`. In Windows `/` is commonly used as the prefix character.
0 commit comments