Closed jacobk closed 6 months ago
This isn't built in, but you could implement it yourself:
val noInput by option().flag()
val foo by option().transformAll {
when {
noInput -> "foo default" // or `throw MissingOption(this)` if it's required
else -> terminal.prompt("Enter foo")
}
}
Cool resource, btw! I sent a PR to add Clikt: https://github.com/cli-guidelines/cli-guidelines/pull/128
This isn't built in, but you could implement it yourself:
val noInput by option().flag() val foo by option().transformAll { when { noInput -> "foo default" // or `throw MissingOption(this)` if it's required else -> terminal.prompt("Enter foo") } }
Thanks! Didn't know about transformAll
.
Hello!
In line with https://clig.dev/#interactivity
It would be great to have the ability to disable all
prompt()
and have them fall back to being normal options. Including handling ofrequired()
as needed.Maybe this is already possible?