I am implementing a python CLI with Click. I wait to add an optional string parameter --name
but I want to its length. Is there a native way to do that with click? e.g. some option to pass to @option
Asked
Active
Viewed 292 times
-1

Martin Faucheux
- 884
- 9
- 26
-
Welcome to [Stack Overflow.](https://stackoverflow.com/ "Stack Overflow")! Questions that ask for general guidance regarding a problem approach are typically too broad and are not a good fit for this site. People have their own method for approaching the problem and because of this there cannot be a correct answer. Give a good read over [Where to Start](https://softwareengineering.meta.stackexchange.com/questions/6366/where-to-start/6367#6367), and [Minimal Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example "Minimal Reproducible Example") then edit your post. – itprorh66 Jun 01 '22 at 12:59
1 Answers
1
You can do the validation yourself by checking the length and raising a length error for the end user to know, but otherwise, there is no built-in way for click to enforce that

afterburner
- 2,552
- 13
- 21