Option Builder
Builder for creating command-line options with various configurations and constraints.
This class provides a fluent API for defining options, including type refinements, constraints, environment variable support, and help text.
Functions
Sets the arity (number of required values) for this option.
Ensures at least one of this option and the specified properties is provided.
Ensures at most one of this option and the specified properties is provided.
Converts string option to boolean option.
Specifies that this option conflicts with the specified properties.
Converts boolean option to count collector.
Sets a default value for nullable option, making it non-nullable.
Converts string option to double option.
Makes boolean option eager (evaluated immediately, causing early exit).
Ensures exactly one of this option and the specified properties is provided.
Converts string option to float option.
Configures this option to read its value from the specified environment variable.
Sets help text for this option.
Marks this option as hidden from help output.
Converts string option to integer option.
Converts option to list collector.
Converts string option to long option.
Maps the parsed value using the specified transformation function. For non-nullable builders (from .default() or .required()), preserves non-nullable type when transformation returns non-null. For nullable builders, always returns nullable type.
Makes this nullable boolean option negatable with a custom prefix. Creates an automatic negation option (e.g., --disable-colors for --colors with prefix "disable-").
Makes this non-nullable boolean option negatable with a custom prefix. Creates an automatic negation option (e.g., --disable-colors for --colors with prefix "disable-").
Restricts string option to one of the specified allowed values.
Restricts this option to be available only in the specified domains.
Registers a callback to be executed when this option's value is found during parsing. The callback receives the converted value and is executed after all parsing and validation completes. Callbacks are executed in the order their values appear on the command line.
Converts string option to password option with prompting capabilities.
Provides the property delegate implementation for command-line options. This method is called automatically by Kotlin's property delegation system. It registers the option with the Arguments instance and returns a delegate that provides access to the parsed value.
Marks this option as required.
Marks this nullable option as required, converting it to a non-nullable type.
Requires that this option be present when all of the specified properties are present.
Requires that this option be present along with any of the specified properties.
Requires that this option be present when the specified property matches the given predicate.
Controls whether this option requires a value.
Converts option to set collector.