Skip to content

Instantly share code, notes, and snippets.

@martinbonnin
Created February 13, 2020 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martinbonnin/04207a445349a1b18208881b519f2646 to your computer and use it in GitHub Desktop.
Save martinbonnin/04207a445349a1b18208881b519f2646 to your computer and use it in GitHub Desktop.
#!/usr/bin/env kscript
@file:DependsOn("com.github.ajalt:clikt:2.4.0")
import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.parameters.options.default
import com.github.ajalt.clikt.parameters.options.option
import com.github.ajalt.clikt.parameters.options.required
import com.github.ajalt.clikt.parameters.types.int
class Hello : CliktCommand(name = "hello") {
val count by option(help = "Nombre de fois").int().default(1)
val name by option(help = "Votre nom").required()
override fun run() {
for (i in 1..count) {
echo("Hello $name!")
}
}
}
Hello().main(args)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment