ajalt / clikt

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

Introduce separate `clikt-core` module that has no dependencies #516

Closed ajalt closed 3 months ago

ajalt commented 3 months ago

This PR splits the code into two modules: clikt-core which contains most of the code and has zero dependencies, and clikt-mordant which depends on mordant and clikt-core and contains only the code that requires mordant.

The command type heirarcy is now BaseCliktCommand (no run function or mordant) -> CoreCliktCommand (no mordant) -> CliktCommand (all features).

Some new Context configuration porperties like exitProcess were added to allow plugging in mordant, and custom command types can call Context.installMordant() to set them all up at once.

Fortunately, the MordantHelpFormatter was already pretty customizable, so I was able to extract most of it to a base class and create a new PlaintextHelpFormatter without much extra code.

The maven coordinates for clikt-mordant are still com.github.ajalt.clikt:clikt, so the default feature set doesn't change.

Fixes #507 Fixes #454