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

Functions

Link copied to clipboard
fun <T : Any> RawArgument.choice(vararg choices: <ERROR CLASS><String, T>, ignoreCase: Boolean = false): ProcessedArgument<T, T>
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 RawArgument.choice(vararg choices: String, ignoreCase: Boolean = false): ProcessedArgument<String, String>

Restrict the argument to a fixed set of values.

fun <T : Any> RawOption.choice(vararg choices: <ERROR CLASS><String, T>, metavar: String = mvar(choices.map { it.first }), ignoreCase: Boolean = false): NullableOption<T, T>
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.

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.

Link copied to clipboard
fun ProcessedArgument<InputStream, InputStream>.defaultStdin(): ArgumentDelegate<InputStream>

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.

Link copied to clipboard
fun ProcessedArgument<OutputStream, OutputStream>.defaultStdout(): ArgumentDelegate<OutputStream>

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.

Link copied to clipboard
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

Link copied to clipboard
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.

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.

Link copied to clipboard
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

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.

Link copied to clipboard
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

Link copied to clipboard
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

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.

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.

Link copied to clipboard
fun <T : Comparable<T>> ProcessedArgument<T, T>.restrictTo(range: ClosedRange<T>, clamp: Boolean = false): ProcessedArgument<T, T>
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(range: ClosedRange<T>, clamp: Boolean = false): OptionWithValues<T?, T, T>
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

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).

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).