ajalt / clikt

Multiplatform command line interface parsing for Kotlin
https://ajalt.github.io/clikt/
Apache License 2.0
2.56k stars 123 forks source link

Add imports to example Clikt program #524

Closed m0xb closed 2 months ago

m0xb commented 5 months ago

The example program in the readme and quickstart doc page (https://github.com/ajalt/clikt/blob/master/README.md and https://ajalt.github.io/clikt/quickstart/) don't include imports. Trying to compile fails with "Unresolved reference: CliktCommand".

Screenshot 2024-06-27 at 10 10 49 PM

It looks like the following imports are needed:

import com.github.ajalt.clikt.core.CliktCommand
import com.github.ajalt.clikt.parameters.options.default
import com.github.ajalt.clikt.parameters.options.help
import com.github.ajalt.clikt.parameters.options.option
import com.github.ajalt.clikt.parameters.types.int
import com.github.ajalt.clikt.parameters.options.prompt

I see an old issue mentioning the same thing, but it's closed now: https://github.com/ajalt/clikt/issues/335

EchoEllet commented 4 months ago

Usually, the docs for Java or Kotlin libraries do not include the required imports to be more readable. You can auto import the required classes or functions within the IDE.

It seems this example is not a module or sample in the samples module. If there is an issue that causes build failure, the CI would have caught it.

ajalt commented 2 months ago

I agree with EchoEllet. To save space in the docs, I'll leave out the imports