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
Since I'm not sure already has this option to do, this is a question for "How to"
My UseCase is like below
When args were implemented like
private val name by option().prompt("Name")
.check("Name should be less than 4 words "){ it.length <= 4 }
I want to have behavior like
$ cli_tool_made_by_clikt
Name: xxxxx # name by prompt option and should be less than 4 words
Error: Invalid value for Name: Name should be less than 4 words # want to have failing immediately (1)
Name: # want to have it asking again (2)
Anyway thanks for the awesome framework
The text was updated successfully, but these errors were encountered:
So I agree that your proposed change is an improvement. The reason for the current behavior is that the lambdas for check and validate are called after the entire command line has been parsed. This lets you reference other options from those lambdas.
In order to implement re-prompt after validation failure, we would have to run that option's validation immediately. So there are two approaches:
Run the validation for prompt options early, and document the behavior quirk
Add a validation lambda to prompt specifically. I'm not a fan of this one; it's kludgy and doesn't work well with the rest of the API.
Since I'm not sure already has this option to do, this is a question for "How to"
My UseCase is like below
When args were implemented like
I want to have behavior like
Anyway thanks for the awesome framework
The text was updated successfully, but these errors were encountered: