Package com.github.ajalt.clikt.parameters.types

Functions

choice
Link copied to clipboard
common
fun <T : Any> RawArgument.choice(vararg choices: Pair<String, T>, ignoreCase: Boolean = false): ProcessedArgument<T, T>
Convert the argument based on a fixed set of values.
fun RawArgument.choice(vararg choices: String, ignoreCase: Boolean = false): ProcessedArgument<String, String>
Restrict the argument to a fixed set of values.
fun <T : Any> RawArgument.choice(choices: Map<String, T>, ignoreCase: Boolean = false): ProcessedArgument<T, T>
Convert the argument based on a fixed set of values.
fun <T : Any> RawOption.choice(vararg choices: Pair<String, T>, metavar: String = mvar(choices.map { it.first }), ignoreCase: Boolean = false): NullableOption<T, T>
Convert the option based on a fixed set of values.
fun RawOption.choice(vararg choices: String, metavar: String = mvar(choices.asIterable()), ignoreCase: Boolean = false): NullableOption<String, String>
Restrict the option to a fixed set of values.
fun <T : Any> RawOption.choice(choices: Map<String, T>, metavar: String = mvar(choices.keys), ignoreCase: Boolean = false): NullableOption<T, T>
Convert the option based on a fixed set of values.
defaultStdin
Link copied to clipboard
Use - as the default value for an inputStream argument.
fun NullableOption<InputStream, InputStream>.defaultStdin(): OptionWithValues<InputStream, InputStream, InputStream>
Use - as the default value for an inputStream option.
defaultStdout
Link copied to clipboard
Use - as the default value for an outputStream argument.
fun NullableOption<OutputStream, OutputStream>.defaultStdout(): OptionWithValues<OutputStream, OutputStream, OutputStream>
Use - as the default value for an outputStream option.
double
Link copied to clipboard
common
fun RawArgument.double(): ProcessedArgument<Double, Double>
Convert the argument values to a Double
fun RawOption.double(): OptionWithValues<Double?, Double, Double>
Convert the option values to a Double
enum
Link copied to clipboard
common
inline fun <T : Enum<T>> RawArgument.enum(ignoreCase: Boolean = true, key: (T) -> String = { it.name }): ProcessedArgument<T, T>
Convert the argument to the values of an enum.
inline fun <T : Enum<T>> RawOption.enum(ignoreCase: Boolean = true, key: (T) -> String = { it.name }): NullableOption<T, T>
Convert the option to the values of an enum.
file
Link copied to clipboard
fun RawArgument.file(mustExist: Boolean = false, canBeFile: Boolean = true, canBeDir: Boolean = true, mustBeWritable: Boolean = false, mustBeReadable: Boolean = false, canBeSymlink: Boolean = true): ProcessedArgument<File, File>
Convert the argument to a File.
fun RawOption.file(mustExist: Boolean = false, canBeFile: Boolean = true, canBeDir: Boolean = true, mustBeWritable: Boolean = false, mustBeReadable: Boolean = false, canBeSymlink: Boolean = true): NullableOption<File, File>
Convert the option to a File.
float
Link copied to clipboard
common
fun RawArgument.float(): ProcessedArgument<Float, Float>
Convert the argument values to a Float
fun RawOption.float(): OptionWithValues<Float?, Float, Float>
Convert the option values to a Float
inputStream
Link copied to clipboard
fun RawArgument.inputStream(fileSystem: FileSystem = FileSystems.getDefault()): ProcessedArgument<InputStream, InputStream>
Convert the argument to an InputStream.
fun RawOption.inputStream(fileSystem: FileSystem = FileSystems.getDefault()): NullableOption<InputStream, InputStream>
Convert the option to an InputStream.
int
Link copied to clipboard
common
fun RawArgument.int(): ProcessedArgument<Int, Int>
Convert the argument values to an Int
fun RawOption.int(): OptionWithValues<Int?, Int, Int>
Convert the option values to an Int
long
Link copied to clipboard
common
fun RawArgument.long(): ProcessedArgument<Long, Long>
Convert the argument values to a Long
fun RawOption.long(): OptionWithValues<Long?, Long, Long>
Convert the option values to a Long
outputStream
Link copied to clipboard
fun RawArgument.outputStream(createIfNotExist: Boolean = true, truncateExisting: Boolean = false, fileSystem: FileSystem = FileSystems.getDefault()): ProcessedArgument<OutputStream, OutputStream>
Convert the argument to an OutputStream.
fun RawOption.outputStream(createIfNotExist: Boolean = true, truncateExisting: Boolean = false, fileSystem: FileSystem = FileSystems.getDefault()): NullableOption<OutputStream, OutputStream>
Convert the option to an OutputStream.
path
Link copied to clipboard
fun RawArgument.path(mustExist: Boolean = false, canBeFile: Boolean = true, canBeDir: Boolean = true, mustBeWritable: Boolean = false, mustBeReadable: Boolean = false, canBeSymlink: Boolean = true, fileSystem: FileSystem = FileSystems.getDefault()): ProcessedArgument<Path, Path>
Convert the argument to a Path.
fun RawOption.path(mustExist: Boolean = false, canBeFile: Boolean = true, canBeDir: Boolean = true, mustBeWritable: Boolean = false, mustBeReadable: Boolean = false, canBeSymlink: Boolean = true, fileSystem: FileSystem = FileSystems.getDefault()): NullableOption<Path, Path>
Convert the option to a Path.
restrictTo
Link copied to clipboard
common
fun <T : Comparable<T>> ProcessedArgument<T, T>.restrictTo(range: ClosedRange<T>, clamp: Boolean = false): ProcessedArgument<T, T>
Restrict the argument values to fit into a range.
fun <T : Comparable<T>> OptionWithValues<T?, T, T>.restrictTo(range: ClosedRange<T>, clamp: Boolean = false): OptionWithValues<T?, T, T>
Restrict the option values to fit into a range.
fun <T : Comparable<T>> ProcessedArgument<T, T>.restrictTo(min: T? = null, max: T? = null, clamp: Boolean = false): ProcessedArgument<T, T>
Restrict the argument values to fit into a range.
fun <T : Comparable<T>> OptionWithValues<T?, T, T>.restrictTo(min: T? = null, max: T? = null, clamp: Boolean = false): OptionWithValues<T?, T, T>
Restrict the option values to fit into a range.

Properties

isCliktParameterDefaultStdin
Link copied to clipboard
val InputStream.isCliktParameterDefaultStdin: Boolean
Checks whether this stream was returned from an inputStream parameter, and that it is reading from System. in (because - was given, or no value was given and the parameter uses defaultStdin).
isCliktParameterDefaultStdout
Link copied to clipboard
val OutputStream.isCliktParameterDefaultStdout: Boolean
Checks whether this stream was returned from an outputStream parameter, and that it is writing to System.out (because - was given, or no value was given and the parameter uses defaultStdout).