Options and arguments can now reference option groups in their defaultLazy and other finalization blocks. They can also freely reference each other, including though chains of references. (#473)
Added MordantHelpFormatter.renderAttachedOptionValue that you can override to change how option values are shown, e.g. if you want option to show as --option <value> instead of --option=<value>. (#416)
Added option().optionalValueLazy{}, which work like optionalValue() but the default value is computed lazily. (#381)
Added Context.errorEncountered which is true if parsing has continued after an error was encountered.
option().help{""} and argument().help{""} extensions that set the parameter’s help text lazily, with access to the current context so that you can add colors.
Option.optionHelp and Argument.argumentHelp, CliktCommand.commandHelp, and CliktCommand.commandHelpEpilog are now methods that take the context as an argument, and the help parameter to copy is now a helpGetter lambda. CliktCommand.shortHelp now takes the context as an argument.
The message method on TransformContext interfaces is now an extension.
Removed CliktConsole. Mordant is now used for all input and output. If you were defining a custom console, instead define a mordant TerminalInterface and set it on your context’s Terminal.
Removed TermUi.echo, TermUi.prompt, and TermUi.confirm. Use the equivalent methods on your CliktCommand, or use mordant’s prompts directly.
Removed legacy JS publications. Now only the JS/IR artifacts are published.
Removed CliktHelpFormatter. Use MordantHelpFormatter instead.
Removed FlagOption and EagerOption classes. All options are now implemented as transformations on OptionWithValues. FlagOption is now OptionWithValues<Boolean, Boolean, Boolean>.
prompt and confirm are now implemented with mordant’s prompt functionality, and the method parameters have changed to match mordant’s
When using treatUnknownOptionsAsArgs, grouped short options like -abc will be treated as an argument rather than reporting an error as long as they don’t match any short options in the command. (#340)
Clikt no longer automatically calls trimIndent on strings passed to help. Call trimIndent or trimMargin yourself if necessary.
Context.Builder.helpOptionNames now accepts any iterable rather than just a set.
CliktCommand.echo and prompt are now public. (#407)
Internally, all options are implemented transformations on OptionWithValues, rather than using separate classes for each option type.
Some Localization strings have changed, removed Localization.aborted(), added Localization.argumentsMetavar()
Context.Builder.helpFormatter is now a lambda that takes the current context as an argument
Exceptions have been reworked so that all exceptions thrown by Clikt are subclasses of CliktError.
CliktError now includes statusCode and printError properties.
The constructor of UsageError and its subclasses no longer takes a context parameter. The context is now inferred automatically.
UsageError.formatUsage now takes the localization and formatter as arguments
InputStream.isCliktParameterDefaultStdin and OutputStream.isCliktParameterDefaultStdout to check if the streams returned from inputStream/outputStream options are proxying stdin/stdout (#272)
Added required() and defaultLazy() for nullable flag options like switch(). (#240)
Added support for generating autocomplete scripts for Fish shells (#189)
Added CompletionCommand and CliktCommand.completionOption() that will print an autocomplete script when invoked, as an alternative to using environment variables.
@argfiles now allow line breaks in quoted values, which are included in the value verbatim. You can now end lines with \ to concatenate them with the following line. (#248)
Clikt’s JS target now supports both NodeJS and Browsers. (#198)
Default values for switch options are now shown in the help. Help text can be customized using the defaultForHelp argument, similar to normal options. (#205)
Argument.help and Option.help properties have been renamed to argumentHelp and optionHelp, respectively. The help parameter names to option() and argument() are unchanged.
commandHelp and commandHelpEpilog properties on CliktCommand are now open, so you can choose to override them instead of passing help and epilog to the constructor.
Replaced MapValueSource.defaultKey with ValueSource.getKey(), which is more customizable.
Option.metavar, Option.parameterHelp, OptionGroup.parameterHelp and Argument.parameterHelp properties are now functions.
Changed constructor parameters of CliktHelpFormatter. Added localization and removed usageTitle, optionsTitle, argumentsTitle, commandsTitle, optionsMetavar, and commandMetavar. Those strings are now defined on equivalently named functions on Localization.
Removed envvarSplit parameter from option() and convert(). Option values from environment variables are no longer split automatically. (#177)
Removed public constructors from the following classes: ProcessedArgument, OptionWithValues, FlagOption, CoOccurringOptionGroup, ChoiceGroup, MutuallyExclusiveOptions.
MissingParameter exception replaced with MissingOption and MissingArgument
Removed Context.helpOptionMessage. Override Localization.helpOptionMessage and set it on your context instead.
When printHelpOnEmptyArgs is true and no arguments are present, or when invokeWithoutSubcommand is false and no subcommand is present, CliktCommand.main will now exit with status code 1 rather than 0.
restrictTo now works with any Comparable value, not just Number.
CliktCommand.main now accepts Array<out String>, not just Array<String>. (#196)
Improved command name inference. Now, a class like MyAppCommand will infer its commandName as my-app rather than myappcommand. You can still specify the name manually as before. (#168)
registeredSubcommands, registeredOptions, registeredArguments, and registeredParameterGroups methods on CliktCommand.
Ability to read default option values from configuration files and other sources. Support for Java property files is built in on JVM, see the json sample for an example of reading from other formats.
allowMultipleSubcommands parameter to CliktCommand that allows you to pass multiple subcommands in the same call. (docs)
Errors from typos in subcommand names will now include suggested corrections. Corrections for options and subcommands are now based on a Jaro-Winkler similarity metric, and can be customized with Context.correctionSuggestor
convert can be called more than once on the same option or argument, including after calls to conversion functions like int and file.
CliktCommand.toString now includes the class name
Reverted automatic ~ expansion in file() and path() introduced in 2.5.0. If you need this behavior, you can implement it with code like convert { /* expand tidle */ }.file()
The parameter names of file() and path() conversions have changed. The existing names are deprecated, and can be converted to the new usages with an IntelliJ inspection. Note that if you are calling these functions with unnamed arguments (e.g. file(true, false)), you’ll need to add argument names in order to remove the deprecation warning.
The CliktCommand.context property has been deprecated in favor of the new name, currentContext, to avoid confusion with the CliktCommand.context{} method.
NoRunCliktCommand was renamed to NoOpCliktCommand. The existing class is deprecated. (#130)
file() and path() conversions will now properly expand leading ~ in paths to the home directory for mustExist, canBeFile, and canBeDir checks. The property value is unchanged, and can still begin with a ~. (#131)
CompletionCandidates.Fixed now has a secondary convenience constructor that take a vararg of Strings
CompletionCadidates.Custom, which allows you to call other binaries or write a script to generate completions. This class is currently experimental. (#79)
Option.wrapValue and Argument.wrapValue to make it easier to reuse existing conversion functions.
ignoreCase parameter to choice() and enum() conversion functions.
option() and argument() now take optional completionCandidates parameters to override how completion is generated. The constructor and copy functions of OptionsWithValues and ProcessedArgument have changed to support default values.
The overloads of findObject (12) that take a default value have been renamed findOrSetObject. The existing names are marked with @Deprecated, and IntelliJ can convert your call sites automatically. (#110)
enum() parameters now accept case-insensitive values by default. You change this behavior by passing ignoreCase = false to enum() (#115)
option().groupSwitch(), which works like groupChoice(), but uses a switch() option rather than a choice() option.
UsageError now has a statusCode parameter (which defaults to 1). If you’re using ClicktCommand.main, the value of statusCode will be passed to exitProcess.
Bash autocomplete script generation. A property named completionCandidates has been added to Argument and Option interfaces, and corresponding parameters have been added to the various implementation constructors, as well as the convert functions. You can use this to control the values autocomplete that will be suggested.
If multiple -- tokens are present on the command line, all subsequent occurrences after the first are now parsed as positional arguments. Previously, subsequent -- tokens were skipped.
The PlaintextHelpFormatter has been replaced with CliktHelpFormatter, which is more customizable. See the docs for more info, or the new sample for an example of customizing help output to use ANSI colors.