Alternative to click types #73
-
In click, I could specify the type of an option, like this: 1 with the types specified here: 2 3 . This is expecially useful for files with the |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
UPDATE(v0.10.0): Click types are now re-exported by Cloup, so you don't need to import Click. Cloup is meant to be used in tandem with Click, it's not a replacement for Click. You can use Click types as you do with Click: import click
import cloup
@cloup.command()
@cloup.option('-o', '--out', type=click.File(...))
def f(out):
... More in general, what you can do with Click, you can do with Cloup too, because Cloup commands are Click commands (subclasses) and Cloup parameters are Click parameters. Note that, even though Cloup has Click as a dependency, you should explicitly add Click to your requirements too because you are gonna use it directly in your code (usually only for types). I'll add this to the installation instructions. |
Beta Was this translation helpful? Give feedback.
-
Update: in v0.10.0, Click types are now re-exported by Cloup, so you don't need to import Click. |
Beta Was this translation helpful? Give feedback.
-
Sounds good, thanks for the quick response! |
Beta Was this translation helpful? Give feedback.
UPDATE(v0.10.0): Click types are now re-exported by Cloup, so you don't need to import Click.
Cloup is meant to be used in tandem with Click, it's not a replacement for Click. You can use Click types as you do with Click:
More in general, what you can do with Click, you can do with Cloup too, because Cloup commands are Click commands (subclasses) and Cloup parameters are Click parameters.
Note that, even though Cloup has Click as a dependency, you should explicitly add Click to your requirements too because you are gonna use it directly in your code (usually only for types).…