outil/opt

Functions

pub fn bool(cmd: Command, long: String, description: String, continue: fn(
    fn(Command, fn(Bool) -> Result(a, CommandReturn(b))) ->
      Result(a, CommandReturn(b)),
    Command,
  ) -> c) -> c

Add a named bool option to the command before continuing.

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

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

pub fn float(cmd: Command, long: String, description: String, default: Float, continue: fn(
    fn(Command, fn(a) -> Result(b, CommandReturn(c))) ->
      Result(b, CommandReturn(c)),
    Command,
  ) -> d) -> d

Add a named float option to the command before continuing.

pub fn float_(cmd: Command, long: String, short: Option(String), description: String, default: Float, continue: fn(
    fn(Command, fn(a) -> Result(b, CommandReturn(c))) ->
      Result(b, CommandReturn(c)),
    Command,
  ) -> d) -> d

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

pub fn int(cmd: Command, long: String, description: String, default: Int, continue: fn(
    fn(Command, fn(a) -> Result(b, CommandReturn(c))) ->
      Result(b, CommandReturn(c)),
    Command,
  ) -> d) -> d

Add a named int option to the command before continuing.

pub fn int_(cmd: Command, long: String, short: Option(String), description: String, default: Int, continue: fn(
    fn(Command, fn(a) -> Result(b, CommandReturn(c))) ->
      Result(b, CommandReturn(c)),
    Command,
  ) -> d) -> d

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, Reason)
pub fn string(cmd: Command, long: String, description: String, default: String, continue: fn(
    fn(Command, fn(a) -> Result(b, CommandReturn(c))) ->
      Result(b, CommandReturn(c)),
    Command,
  ) -> d) -> d

Add a named string option to the command before continuing.

pub fn string_(cmd: Command, long: String, short: Option(String), description: String, default: String, continue: fn(
    fn(Command, fn(a) -> Result(b, CommandReturn(c))) ->
      Result(b, CommandReturn(c)),
    Command,
  ) -> d) -> d

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

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

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