from

fun from(file: Path, requireValid: Boolean = false, getKey: (Context, Option) -> String = ValueSource.getKey(joinSubcommands = ".")): ValueSource
fun from(file: File, requireValid: Boolean = false, getKey: (Context, Option) -> String = ValueSource.getKey(joinSubcommands = ".")): ValueSource
fun from(file: String, requireValid: Boolean = false, getKey: (Context, Option) -> String = ValueSource.getKey(joinSubcommands = ".")): ValueSource

Parse a properties file into a value source.

If the file does not exist, an empty value source will be returned.

Parameters

file

The file to read from.

requireValid

If true, a InvalidFileFormat will be thrown if the file doesn't parse correctly.

getKey

A function that will return the property key for a given option. You can use ValueSource.getKey for most use cases.


fun from(properties: Properties, getKey: (Context, Option) -> String = ValueSource.getKey(joinSubcommands = ".")): ValueSource

Return a ValueSource that reads values from a properties object.

The properties object is copied when this function is called; changes to the object will not be reflected in the value source.

Parameters

properties

The properties to read from.

getKey

A function that will return the property key for a given option.