outil/opt

Functions

pub fn bool(cmd: Command(a), long: String, description: String, continue: fn(
    fn(List(String)) -> Result(Bool, Error),
    Command(a),
  ) -> Command(a)) -> Command(a)

Add a named bool option to the command before continuing.

pub fn bool_(cmd: Command(a), long: String, short: Option(String), description: String, continue: fn(
    fn(List(String)) -> Result(Bool, Error),
    Command(a),
  ) -> Command(a)) -> Command(a)

Add a bool option with a short name to the command before continuing.

pub fn float(cmd: Command(a), long: String, description: String, default: Float, continue: fn(
    fn(List(String)) -> Result(Float, Error),
    Command(a),
  ) -> Command(a)) -> Command(a)

Add a named float option to the command before continuing.

pub fn float_(cmd: Command(a), long: String, short: Option(String), description: String, default: Float, continue: fn(
    fn(List(String)) -> Result(Float, Error),
    Command(a),
  ) -> Command(a)) -> Command(a)

Add a float option with a short name to the command before continuing.

pub fn int(cmd: Command(a), long: String, description: String, default: Int, continue: fn(
    fn(List(String)) -> Result(Int, Error),
    Command(a),
  ) -> Command(a)) -> Command(a)

Add a named int option to the command before continuing.

pub fn int_(cmd: Command(a), long: String, short: Option(String), description: String, default: Int, continue: fn(
    fn(List(String)) -> Result(Int, Error),
    Command(a),
  ) -> Command(a)) -> Command(a)

Add an int option with a short name to the command before continuing.

pub fn named_opt_parser(long: String, short: Option(String), parser: fn(
    String,
  ) -> Result(a, Nil), default: a) -> fn(List(String)) ->
  Result(a, Error)
pub fn string(cmd: Command(a), long: String, description: String, default: String, continue: fn(
    fn(List(String)) -> Result(String, Error),
    Command(a),
  ) -> Command(a)) -> Command(a)

Add a named string option to the command before continuing.

pub fn string_(cmd: Command(a), long: String, short: Option(
    String,
  ), description: String, default: String, continue: fn(
    fn(List(String)) -> Result(String, Error),
    Command(a),
  ) -> Command(a)) -> Command(a)

Add a string option with a short name to the command before continuing.

pub fn with_named_option(cmd: Command(a), opt: Opt, default: b, parse: fn(
    String,
  ) -> Result(b, Nil), continue: fn(
    fn(List(String)) -> Result(b, Error),
    Command(a),
  ) -> Command(a)) -> Command(a)

Add a named option to the command. Bring your own parser.

The continuation function gets a parser for the option and the command with the option added, for further configuration.

Search Document