Big Chungus
01/30/2023, 5:32 PMBig Chungus
01/30/2023, 7:54 PMClikt(name="git") {
Command(name="commit") {
val amend by option().flag()
execute {
// Do stuff the command is supposed to
}
}
Command(name="push") { ... }
}.main(args)
Big Chungus
01/30/2023, 7:56 PMjw
01/30/2023, 7:58 PMjw
01/30/2023, 7:58 PMexecute
instead of the compiler forcing an override.Big Chungus
01/30/2023, 7:59 PMjw
01/30/2023, 8:00 PMBig Chungus
01/30/2023, 8:00 PMjw
01/30/2023, 8:06 PMjw
01/30/2023, 8:07 PMBig Chungus
01/30/2023, 8:10 PMBig Chungus
01/30/2023, 8:10 PMBig Chungus
01/30/2023, 8:11 PMjw
01/30/2023, 8:13 PMjw
01/30/2023, 8:14 PMBig Chungus
01/30/2023, 8:16 PMBig Chungus
02/03/2023, 1:47 AMBig Chungus
02/03/2023, 1:48 AMClikt("my-cmd") {
Command("build") {
val test by option("--test").flag()
execute {
println("BUILD test=${test}")
}
}
}.main(listOf("build", "--test"))
Nice thing about it is that compiler errors if you try to create new option delegates within the execute {}
block.Big Chungus
02/03/2023, 1:52 AMCliktCommand::run
method too. Nice!