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/commands.md
+33-11Lines changed: 33 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,9 @@ Click Extra aims to be a drop-in replacement for Click. The vast majority of Cli
7
7
Here is for instance the [canonical `click` example](https://github.com/pallets/click#a-simple-example) with all original imports replaced with `click_extra`:
8
8
9
9
```{click:example}
10
-
:emphasize-lines: 1
10
+
---
11
+
emphasize-lines: 1
12
+
---
11
13
from click_extra import command, echo, option
12
14
13
15
@command
@@ -110,7 +112,9 @@ The `@extra_command` and `@extra_group` decorators are [pre-configured with a se
110
112
You can remove all default options by resetting the `params` argument to `None`:
111
113
112
114
```{click:example}
113
-
:emphasize-lines: 3
115
+
---
116
+
emphasize-lines: 3
117
+
---
114
118
from click_extra import extra_command
115
119
116
120
@extra_command(params=None)
@@ -140,7 +144,9 @@ As you can see, all options are stripped out, but the colouring and formatting o
140
144
To override the default options, you can provide the `params=` argument to the command. But note how we use classes instead of option decorators:
141
145
142
146
```{click:example}
143
-
:emphasize-lines: 4-7
147
+
---
148
+
emphasize-lines: 4-7
149
+
---
144
150
from click_extra import extra_command, ConfigOption, VerbosityOption
This let you replace the preset options by your own set, tweak their order and fine-tune their defaults.
172
180
173
181
````{admonition} Duplicate options
174
-
:class: caution
182
+
---
183
+
class: caution
184
+
---
175
185
If you try to add option decorators to a command which already have them by default, you will end up with duplicate entries ([as seen in issue #232](https://github.com/kdeldycke/click-extra/issues/232)):
176
186
177
187
```{click:example}
@@ -221,7 +231,9 @@ For example, the [`--verbosity` option defaults to the `WARNING` level](logging.
221
231
If you manage your own `--verbosity` option, you can [pass the `default` argument to its decorator like we did above](#change-default-options):
0 commit comments