Releases: ajalt/clikt
Releases · ajalt/clikt
3.0.1
3.0.0
Clikt 3.0 is a major release with a number of improvements and a few breaking API changes.
Highlights of this release
- Support for Browser JS targets
- Support for localization of all help output
- New extensions like
help()
andcheck()
to make it even easier to setup your commands.
See the full list of changes here, and a migration guide here.
2.8.0
Added
- Added
error
parameter toPrintMessage
andPrintHelpMessage
. Whentrue
,CliktCommand.main
will exit with status code 1. (#187)
Changed
- When
printHelpOnEmptyArgs
istrue
and no arguments are present, or wheninvokeWithoutSubcommand
isfalse
and no subcommand is present,CliktCommand.main
will now exit with status code 1 rather than 0. restrictTo
now works with anyComparable
value, not justNumber
.CliktCommand.main
now acceptsArray<out String>
, not justArray<String>
. (#196)
Fixed
- Fixed option values being reset when calling multiple subcommands with
allowMultipleSubcommands=true
(#190)
2.7.1
2.7.0
Added
- Ability to use custom program exit status codes via
ProgramResult
. inputStream
andoutputStream
conversions for options and arguments. (#157 and #159)splitPair
,toMap
, andassociate
extensions onoption
. (#166)treatUnknownOptionsAsArgs
parameter toCliktCommand
. (#152)defaultByName
function forgroupChoice
andgroupSwitch
options. (#171)
Changed
- Update Kotlin to 1.3.71
- Improved command name inference. Now, a class like
MyAppCommand
will infer itscommandName
asmy-app
rather thanmyappcommand
. You can still specify the name manually as before. (#168)
Fixed
- Correctly parse short options with attached values that contain
=
Thanks to @sschuberth for his contributions to this release!
2.6.0
Added
registeredSubcommands
,registeredOptions
,registeredArguments
, andregisteredParameterGroups
methods onCliktCommand
.- 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 toCliktCommand
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
Changed
- Update Kotlin to 1.3.70
convert
can be called more than once on the same option or argument, including after calls to conversion functions likeint
andfile
.wrapValue
is now deprecated, sinceconvert
can be used in its place instead.CliktCommand.toString
now includes the class name- Reverted automatic
~
expansion infile()
andpath()
introduced in 2.5.0. If you need this behavior, you can implement it with code likeconvert { /* expand tidle */ }.file()
2.5.0
Added
- Clikt is now available as a Kotlin Multiplatform Project, supporting JVM, NodeJS, and native Windows, Linux, and macOS.
eagerOption {}
function to more easily register eager options.- Eager options can now be added to option groups in help out by passing a value for
groupName
when creating them. canBeSymlink
parameter tofile()
andpath()
conversions that can be used to disallow symlinksCliktCommand.eagerOption
to simplify creating custom eager options
Changed
NoRunCliktCommand
was renamed toNoOpCliktCommand
. The existing class is deprecated. (#130)- The
CliktCommand.context
property has been deprecated in favor of the new name,currentContext
, to avoid confusion with theCliktCommand.context{}
method. - The parameter names of
file()
andpath()
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.
Fixed
file()
andpath()
conversions will now properly expand leading~
in paths to the home directory formustExist
,canBeFile
, andcanBeDir
checks. The property value is unchanged, and can still begin with a~
. (#131)
2.4.0
Added
CompletionCandidates.Fixed
now has a secondary convenience constructor that take avararg
ofString
sCompletionCadidates.Custom
, which allows you to call other binaries or write a script to generate completions. This class is currently experimental. (#79)Option.wrapValue
andArgument.wrapValue
to make it easier to reuse existing conversion functions.ignoreCase
parameter tochoice()
andenum()
conversion functions.
Changed
option()
andargument()
now take optionalcompletionCandidates
parameters to override how completion is generated. The constructor andcopy
functions ofOptionsWithValues
andProcessedArgument
have changed to support default values.- The overloads of
findObject
(1 2) that take a default value have been renamedfindOrSetObject
. The existing names are marked with@Deprecated
, and IntelliJ can convert your callsites automatically. (#110) enum()
parameters now accept case-insensitive values by default. You change this behavior by passingignoreCase = false
toenum()
(#115)
Fixed
groupChoice
help output now includes the choices in the help output metavarTermUi.edit*
functions could freeze on certain editors (#99, thanks @iampravikant and @sebokopter)- Shell completion can now handle command names with dashes. (#104)
- Arguments with
=
in them could be incorrectly interpreted as options (#106)
2.3.0
Added
option().groupSwitch()
, which works likegroupChoice()
, but uses aswitch()
option rather than achoice()
option.UsageError
now has astatusCode
parameter (which defaults to 1). If you're usingClicktCommand.main
, the value ofstatusCode
will be passed toexitProcess
.
Changed
- Shell completion code is now printed by throwing a
PrintCompletionMessage
(a subclass ofPrintMessage
) rather than callingecho
directly.
2.2.0
Added
- Added
enum()
conversion for options and arguments. (#84)
Changed
- There are now several ways of preventing @-file expansion