Opt
Options that your CLI will parse as fields in your config.
single : DefaultableOptionConfigParams a -> CliBuilder a GetOptionsAction GetOptionsAction
Add a required option that takes a custom type to your CLI builder.
You need to provide a kebab-case type name for your help messages as well as a
parser for said type. The parser needs to return an Err (InvalidValue Str)
on failure, where the Str
is the reason the parsing failed that will
get displayed in the incorrect usage message.
Parsing arguments will fail if the option is not given as an argument or a value is not provided to the option.
expect Color : [Green, Red, Blue] parse_color : Arg -> Result Color [InvalidValue Str, InvalidUtf8] parse_color = \color -> when Arg.to_str color is Ok "green" -> Ok Green Ok "red" -> Ok Red Ok "blue" -> Ok Blue other -> Err (InvalidValue "'$(other)' is not a valid color, must be green, red, or blue") { parser } = Opt.single { short: "c", parser: parse_color, type: "color" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "-c", "green"] == SuccessfullyParsed Green
maybe : OptionConfigParams data -> CliBuilder (Result data [NoValue]) GetOptionsAction GetOptionsAction
Add an optional option that takes a custom type to your CLI builder.
You need to provide a kebab-case type name for your help messages as well as a
parser for said type. The parser needs to return an Err (InvalidValue Str)
on failure, where the Str
is the reason the parsing failed that will
get displayed in the incorrect usage message.
Parsing arguments will fail if more than one instance of the argument is provided, there is no value given for the option call, or the value doesn't parse correctly.
expect Color : [Green, Red, Blue] parse_color : Arg -> Result Color [InvalidValue Str, InvalidUtf8] parse_color = \color -> when Arg.to_str color is Ok "green" -> Ok Green Ok "red" -> Ok Red Ok "blue" -> Ok Blue other -> Err (InvalidValue "'$(other)' is not a valid color, must be green, red, or blue") { parser } = Opt.maybe { short: "c", type: "color", parser: parse_color }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example"] == SuccessfullyParsed (Err NoValue)
list : OptionConfigParams data -> CliBuilder (List data) GetOptionsAction GetOptionsAction
Add an option that takes a custom type and can be given multiple times to your CLI builder.
You need to provide a kebab-case type name for your help messages as well as a
parser for said type. The parser needs to return an Err (InvalidValue Str)
on failure, where the Str
is the reason the parsing failed that will
get displayed in the incorrect usage message.
Parsing arguments will fail if any calls of the option don't provide a value or any of the options don't parse correctly.
expect Color : [Green, Red, Blue] parse_color : Arg -> Result Color [InvalidValue Str, InvalidUtf8] parse_color = \color -> when Arg.to_str color is Ok "green" -> Ok Green Ok "red" -> Ok Red Ok "blue" -> Ok Blue other -> Err (InvalidValue "'$(other)' is not a valid color, must be green, red, or blue") { parser } = Opt.list { short: "c", type: "color", parser: parse_color }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "-c", "green", "--color=red"] == SuccessfullyParsed [Green, Red]
flag : OptionConfigBaseParams -> CliBuilder Bool GetOptionsAction GetOptionsAction
Add an optional flag to your CLI builder.
Parsing arguments will fail if the flag is given more than once
or if a value is provided to it, e.g. --flag=value
.
expect { parser } = Opt.flag { short: "f", long: "force" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "-f"] == SuccessfullyParsed Bool.true
count : OptionConfigBaseParams -> CliBuilder U64 GetOptionsAction GetOptionsAction
Add a flag that can be given multiple times to your CLI builder.
Parsing arguments will fail if this flag is ever given a value,
e.g. --flag=value
.
expect { parser } = Opt.count { short: "f", long: "force" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "-f", "--force", "-fff"] == SuccessfullyParsed 5
arg : DefaultableOptionConfigBaseParams Arg -> CliBuilder Arg GetOptionsAction GetOptionsAction
Add a required option that takes an Arg
to your CLI builder.
Parsing arguments will fail if the option is not given as an argument or a value is not provided to the option.
expect { parser } = Opt.arg { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "--answer=abc"] == SuccessfullyParsed (Arg.from_str "abc")
maybe_arg : OptionConfigBaseParams -> CliBuilder (Result Arg [NoValue]) GetOptionsAction GetOptionsAction
Add an optional option that takes an Arg
to your CLI builder.
Parsing arguments will fail if more than one instance of the argument is provided or there is no value given for the option call.
expect { parser } = Opt.maybe_arg { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example"] == SuccessfullyParsed (Err NoValue)
arg_list : OptionConfigBaseParams -> CliBuilder (List Arg) GetOptionsAction GetOptionsAction
Add an option that takes an Arg
and can be given multiple times
to your CLI builder.
Parsing arguments will fail if any calls of the option don't provide a value.
expect { parser } = Opt.arg_list { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "-a", "abc", "--answer", "def", "--answer=ghi"] == SuccessfullyParsed (List.map ["abc", "def", "ghi"] Arg.from_str)
bytes : DefaultableOptionConfigBaseParams (List U8) -> CliBuilder (List U8) GetOptionsAction GetOptionsAction
Add a required option that takes a byte list to your CLI builder.
Parsing arguments will fail if the option is not given as an argument or a value is not provided to the option.
expect { parser } = Opt.bytes { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "--answer=abc"] == SuccessfullyParsed [97, 98, 99]
maybe_bytes : OptionConfigBaseParams -> CliBuilder (Result (List U8) [NoValue]) GetOptionsAction GetOptionsAction
Add an optional option that takes a byte list to your CLI builder.
Parsing arguments will fail if more than one instance of the argument is provided or there is no value given for the option call.
expect { parser } = Opt.maybe_bytes { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example"] == SuccessfullyParsed (Err NoValue)
bytes_list : OptionConfigBaseParams -> CliBuilder (List (List U8)) GetOptionsAction GetOptionsAction
Add an option that takes a byte list and can be given multiple times to your CLI builder.
Parsing arguments will fail if any calls of the option don't provide a value.
expect { parser } = Opt.bytes_list { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "-a", "abc", "--answer", "def", "--answer=ghi"] == SuccessfullyParsed [[97, 98, 99], [100, 101, 102], [103, 104, 105]]
str : DefaultableOptionConfigBaseParams Str -> CliBuilder Str GetOptionsAction GetOptionsAction
Add a required option that takes a string to your CLI builder.
Parsing arguments will fail if the option is not given as an argument, a value is not provided to the option, or the value is not valid UTF-8.
expect { parser } = Opt.str { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "--answer=abc"] == SuccessfullyParsed "abc"
maybe_str : OptionConfigBaseParams -> CliBuilder (Result Str [NoValue]) GetOptionsAction GetOptionsAction
Add an optional option that takes a string to your CLI builder.
Parsing arguments will fail if more than one instance of the argument is provided, there is no value given for the option call, or the value is not valid UTF-8.
expect { parser } = Opt.maybe_str { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example"] == SuccessfullyParsed (Err NoValue)
str_list : OptionConfigBaseParams -> CliBuilder (List Str) GetOptionsAction GetOptionsAction
Add an option that takes a string and can be given multiple times to your CLI builder.
Parsing arguments will fail if any calls of the option don't provide a value or any of the values are not valid UTF-8.
expect { parser } = Opt.str_list { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "-a", "abc", "--answer", "def", "--answer=ghi"] == SuccessfullyParsed ["abc", "def", "ghi"]
dec : DefaultableOptionConfigBaseParams Dec -> CliBuilder Dec GetOptionsAction GetOptionsAction
Add a required option that takes a Dec
to your CLI builder.
Parsing arguments will fail if the option is not given as an argument, a value is not provided to the option, or the value is not a number.
expect { parser } = Opt.dec { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "--answer=42.5"] == SuccessfullyParsed 42.5
maybe_dec : OptionConfigBaseParams -> CliBuilder (Result Dec [NoValue]) GetOptionsAction GetOptionsAction
Add an optional option that takes a Dec
to your CLI builder.
Parsing arguments will fail if a value is not provided to the option, the value is not a number, or there is more than one call to the option.
expect { parser } = Opt.maybe_dec { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example"] == SuccessfullyParsed (Err NoValue)
dec_list : OptionConfigBaseParams -> CliBuilder (List Dec) GetOptionsAction GetOptionsAction
Add an option that takes a Dec
and can be given multiple times
to your CLI builder.
Parsing arguments will fail if any calls of the option don't provide a value, or the values are not all numbers.
expect { parser } = Opt.dec_list { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "-a", "1", "--answer=2", "--answer", "-3.0"] == SuccessfullyParsed [1.0, 2.0, -3.0]
f32 : DefaultableOptionConfigBaseParams F32 -> CliBuilder F32 GetOptionsAction GetOptionsAction
Add a required option that takes a F32
to your CLI builder.
Parsing arguments will fail if the option is not given as an argument, a value is not provided to the option, or the value is not a number.
expect { parser } = Opt.f32 { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "--answer=42.5"] == SuccessfullyParsed 42.5
maybe_f32 : OptionConfigBaseParams -> CliBuilder (Result F32 [NoValue]) GetOptionsAction GetOptionsAction
Add an optional option that takes a F32
to your CLI builder.
Parsing arguments will fail if a value is not provided to the option, the value is not a number, or there is more than one call to the option.
expect { parser } = Opt.maybe_f32 { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example"] == SuccessfullyParsed (Err NoValue)
f32_list : OptionConfigBaseParams -> CliBuilder (List F32) GetOptionsAction GetOptionsAction
Add an option that takes a F32
and can be given multiple times
to your CLI builder.
Parsing arguments will fail if any calls of the option don't provide a value, or the values are not all numbers.
expect { parser } = Opt.f32_list { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "-a", "1", "--answer=2", "--answer", "-3.0"] == SuccessfullyParsed [1.0, 2.0, -3.0]
f64 : DefaultableOptionConfigBaseParams F64 -> CliBuilder F64 GetOptionsAction GetOptionsAction
Add a required option that takes a F64
to your CLI builder.
Parsing arguments will fail if the option is not given as an argument, a value is not provided to the option, or the value is not a number.
expect { parser } = Opt.f64 { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "--answer=42.5"] == SuccessfullyParsed 42.5
maybe_f64 : OptionConfigBaseParams -> CliBuilder (Result F64 [NoValue]) GetOptionsAction GetOptionsAction
Add an optional option that takes a F64
to your CLI builder.
Parsing arguments will fail if a value is not provided to the option, the value is not a number, or there is more than one call to the option.
expect { parser } = Opt.maybe_f64 { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example"] == SuccessfullyParsed (Err NoValue)
f64_list : OptionConfigBaseParams -> CliBuilder (List F64) GetOptionsAction GetOptionsAction
Add an option that takes a F64
and can be given multiple times
to your CLI builder.
Parsing arguments will fail if any calls of the option don't provide a value, or the values are not all numbers.
expect { parser } = Opt.f64_list { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "-a", "1", "--answer=2", "--answer", "-3.0"] == SuccessfullyParsed [1.0, 2.0, -3.0]
u8 : DefaultableOptionConfigBaseParams U8 -> CliBuilder U8 GetOptionsAction GetOptionsAction
Add a required option that takes a U8
to your CLI builder.
Parsing arguments will fail if the option is not given as an argument, a value is not provided to the option, or the value is not a number.
expect { parser } = Opt.u8 { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "--answer=42"] == SuccessfullyParsed 42
maybe_u8 : OptionConfigBaseParams -> CliBuilder (Result U8 [NoValue]) GetOptionsAction GetOptionsAction
Add an optional option that takes a U8
to your CLI builder.
Parsing arguments will fail if a value is not provided to the option, the value is not a number, or there is more than one call to the option.
expect { parser } = Opt.maybe_u8 { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example"] == SuccessfullyParsed (Err NoValue)
u8_list : OptionConfigBaseParams -> CliBuilder (List U8) GetOptionsAction GetOptionsAction
Add an option that takes a U8
and can be given multiple times
to your CLI builder.
Parsing arguments will fail if any calls of the option don't provide a value, or the values are not all numbers.
expect { parser } = Opt.u8_list { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "-a", "1", "--answer=2", "--answer", "3"] == SuccessfullyParsed [1, 2, 3]
u16 : DefaultableOptionConfigBaseParams U16 -> CliBuilder U16 GetOptionsAction GetOptionsAction
Add a required option that takes a U16
to your CLI builder.
Parsing arguments will fail if the option is not given as an argument, a value is not provided to the option, or the value is not a number.
expect { parser } = Opt.u16 { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "--answer=42"] == SuccessfullyParsed 42
maybe_u16 : OptionConfigBaseParams -> CliBuilder (Result U16 [NoValue]) GetOptionsAction GetOptionsAction
Add an optional option that takes a U16
to your CLI builder.
Parsing arguments will fail if a value is not provided to the option, the value is not a number, or there is more than one call to the option.
expect { parser } = Opt.maybe_u16 { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example"] == SuccessfullyParsed (Err NoValue)
u16_list : OptionConfigBaseParams -> CliBuilder (List U16) GetOptionsAction GetOptionsAction
Add an option that takes a U16
and can be given multiple times
to your CLI builder.
Parsing arguments will fail if any calls of the option don't provide a value, or the values are not all numbers.
expect { parser } = Opt.u16_list { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "-a", "1", "--answer=2", "--answer", "3"] == SuccessfullyParsed [1, 2, 3]
u32 : DefaultableOptionConfigBaseParams U32 -> CliBuilder U32 GetOptionsAction GetOptionsAction
Add a required option that takes a U32
to your CLI builder.
Parsing arguments will fail if the option is not given as an argument, a value is not provided to the option, or the value is not a number.
expect { parser } = Opt.u32 { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "--answer=42"] == SuccessfullyParsed 42
maybe_u32 : OptionConfigBaseParams -> CliBuilder (Result U32 [NoValue]) GetOptionsAction GetOptionsAction
Add an optional option that takes a U32
to your CLI builder.
Parsing arguments will fail if a value is not provided to the option, the value is not a number, or there is more than one call to the option.
expect { parser } = Opt.maybe_u32 { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example"] == SuccessfullyParsed (Err NoValue)
u32_list : OptionConfigBaseParams -> CliBuilder (List U32) GetOptionsAction GetOptionsAction
Add an option that takes a U32
and can be given multiple times
to your CLI builder.
Parsing arguments will fail if any calls of the option don't provide a value, or the values are not all numbers.
expect { parser } = Opt.u32_list { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "-a", "1", "--answer=2", "--answer", "3"] == SuccessfullyParsed [1, 2, 3]
u64 : DefaultableOptionConfigBaseParams U64 -> CliBuilder U64 GetOptionsAction GetOptionsAction
Add a required option that takes a U64
to your CLI builder.
Parsing arguments will fail if the option is not given as an argument, a value is not provided to the option, or the value is not a number.
expect { parser } = Opt.u64 { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "--answer=42"] == SuccessfullyParsed 42
maybe_u64 : OptionConfigBaseParams -> CliBuilder (Result U64 [NoValue]) GetOptionsAction GetOptionsAction
Add an optional option that takes a U64
to your CLI builder.
Parsing arguments will fail if a value is not provided to the option, the value is not a number, or there is more than one call to the option.
expect { parser } = Opt.maybe_u64 { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example"] == SuccessfullyParsed (Err NoValue)
u64_list : OptionConfigBaseParams -> CliBuilder (List U64) GetOptionsAction GetOptionsAction
Add an option that takes a U64
and can be given multiple times
to your CLI builder.
Parsing arguments will fail if any calls of the option don't provide a value, or the values are not all numbers.
expect { parser } = Opt.u64_list { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "-a", "1", "--answer=2", "--answer", "3"] == SuccessfullyParsed [1, 2, 3]
u128 : DefaultableOptionConfigBaseParams U128 -> CliBuilder U128 GetOptionsAction GetOptionsAction
Add a required option that takes a U128
to your CLI builder.
Parsing arguments will fail if the option is not given as an argument, a value is not provided to the option, or the value is not a number.
expect { parser } = Opt.u128 { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "--answer=42"] == SuccessfullyParsed 42
maybe_u128 : OptionConfigBaseParams -> CliBuilder (Result U128 [NoValue]) GetOptionsAction GetOptionsAction
Add an optional option that takes a U128
to your CLI builder.
Parsing arguments will fail if a value is not provided to the option, the value is not a number, or there is more than one call to the option.
expect { parser } = Opt.maybe_u128 { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example"] == SuccessfullyParsed (Err NoValue)
u128_list : OptionConfigBaseParams -> CliBuilder (List U128) GetOptionsAction GetOptionsAction
Add an option that takes a U128
and can be given multiple times
to your CLI builder.
Parsing arguments will fail if any calls of the option don't provide a value, or the values are not all numbers.
expect { parser } = Opt.u128_list { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "-a", "1", "--answer=2", "--answer", "3"] == SuccessfullyParsed [1, 2, 3]
i8 : DefaultableOptionConfigBaseParams I8 -> CliBuilder I8 GetOptionsAction GetOptionsAction
Add a required option that takes an I8
to your CLI builder.
Parsing arguments will fail if the option is not given as an argument, a value is not provided to the option, or the value is not a number.
expect { parser } = Opt.i8 { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "--answer=42"] == SuccessfullyParsed 42
maybe_i8 : OptionConfigBaseParams -> CliBuilder (Result I8 [NoValue]) GetOptionsAction GetOptionsAction
Add an optional option that takes an I8
to your CLI builder.
Parsing arguments will fail if a value is not provided to the option, the value is not a number, or there is more than one call to the option.
expect { parser } = Opt.maybe_i8 { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example"] == SuccessfullyParsed (Err NoValue)
i8_list : OptionConfigBaseParams -> CliBuilder (List I8) GetOptionsAction GetOptionsAction
Add an option that takes an I8
and can be given multiple times
to your CLI builder.
Parsing arguments will fail if any calls of the option don't provide a value, or the values are not all numbers.
expect { parser } = Opt.i8_list { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "-a", "1", "--answer=2", "--answer", "3"] == SuccessfullyParsed [1, 2, 3]
i16 : DefaultableOptionConfigBaseParams I16 -> CliBuilder I16 GetOptionsAction GetOptionsAction
Add a required option that takes an I16
to your CLI builder.
Parsing arguments will fail if the option is not given as an argument, a value is not provided to the option, or the value is not a number.
expect { parser } = Opt.i16 { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "--answer=42"] == SuccessfullyParsed 42
maybe_i16 : OptionConfigBaseParams -> CliBuilder (Result I16 [NoValue]) GetOptionsAction GetOptionsAction
Add an optional option that takes an I16
to your CLI builder.
Parsing arguments will fail if a value is not provided to the option, the value is not a number, or there is more than one call to the option.
expect { parser } = Opt.maybe_i16 { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example"] == SuccessfullyParsed (Err NoValue)
i16_list : OptionConfigBaseParams -> CliBuilder (List I16) GetOptionsAction GetOptionsAction
Add an option that takes an I16
and can be given multiple times
to your CLI builder.
Parsing arguments will fail if any calls of the option don't provide a value, or the values are not all numbers.
expect { parser } = Opt.i16_list { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "-a", "1", "--answer=2", "--answer", "3"] == SuccessfullyParsed [1, 2, 3]
i32 : DefaultableOptionConfigBaseParams I32 -> CliBuilder I32 GetOptionsAction GetOptionsAction
Add a required option that takes an I32
to your CLI builder.
Parsing arguments will fail if the option is not given as an argument, a value is not provided to the option, or the value is not a number.
expect { parser } = Opt.i32 { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "--answer=42"] == SuccessfullyParsed 42
maybe_i32 : OptionConfigBaseParams -> CliBuilder (Result I32 [NoValue]) GetOptionsAction GetOptionsAction
Add an optional option that takes an I32
to your CLI builder.
Parsing arguments will fail if a value is not provided to the option, the value is not a number, or there is more than one call to the option.
expect { parser } = Opt.maybe_i32 { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example"] == SuccessfullyParsed (Err NoValue)
i32_list : OptionConfigBaseParams -> CliBuilder (List I32) GetOptionsAction GetOptionsAction
Add an option that takes an I32
and can be given multiple times
to your CLI builder.
Parsing arguments will fail if any calls of the option don't provide a value, or the values are not all numbers.
expect { parser } = Opt.i32_list { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "-a", "1", "--answer=2", "--answer", "3"] == SuccessfullyParsed [1, 2, 3]
i64 : DefaultableOptionConfigBaseParams I64 -> CliBuilder I64 GetOptionsAction GetOptionsAction
Add a required option that takes an I64
to your CLI builder.
Parsing arguments will fail if the option is not given as an argument, a value is not provided to the option, or the value is not a number.
expect { parser } = Opt.i64 { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "--answer=42"] == SuccessfullyParsed 42
maybe_i64 : OptionConfigBaseParams -> CliBuilder (Result I64 [NoValue]) GetOptionsAction GetOptionsAction
Add an optional option that takes an I64
to your CLI builder.
Parsing arguments will fail if a value is not provided to the option, the value is not a number, or there is more than one call to the option.
expect { parser } = Opt.maybe_i64 { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example"] == SuccessfullyParsed (Err NoValue)
i64_list : OptionConfigBaseParams -> CliBuilder (List I64) GetOptionsAction GetOptionsAction
Add an option that takes an I64
and can be given multiple times
to your CLI builder.
Parsing arguments will fail if any calls of the option don't provide a value, or the values are not all numbers.
expect { parser } = Opt.i64_list { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "-a", "1", "--answer=2", "--answer", "3"] == SuccessfullyParsed [1, 2, 3]
i128 : DefaultableOptionConfigBaseParams I128 -> CliBuilder I128 GetOptionsAction GetOptionsAction
Add a required option that takes an I128
to your CLI builder.
Parsing arguments will fail if the option is not given as an argument, a value is not provided to the option, or the value is not a number.
expect { parser } = Opt.i128 { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "--answer=42"] == SuccessfullyParsed 42
maybe_i128 : OptionConfigBaseParams -> CliBuilder (Result I128 [NoValue]) GetOptionsAction GetOptionsAction
Add an optional option that takes an I128
to your CLI builder.
Parsing arguments will fail if a value is not provided to the option, the value is not a number, or there is more than one call to the option.
expect { parser } = Opt.maybe_i128 { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example"] == SuccessfullyParsed (Err NoValue)
i128_list : OptionConfigBaseParams -> CliBuilder (List I128) GetOptionsAction GetOptionsAction
Add an option that takes an I128
and can be given multiple times
to your CLI builder.
Parsing arguments will fail if any calls of the option don't provide a value, or the values are not all numbers.
expect { parser } = Opt.i128_list { long: "answer" }, |> Cli.finish { name: "example" } |> Cli.assert_valid parser ["example", "-a", "1", "--answer=2", "--answer", "3"] == SuccessfullyParsed [1, 2, 3]