sheen/command

Types

pub type ArgSpec {
  ArgSpec(
    display: option.Option(String),
    repeated: Bool,
    optional: Bool,
    help: String,
  )
}

Constructors

  • ArgSpec(
      display: option.Option(String),
      repeated: Bool,
      optional: Bool,
      help: String,
    )
pub type Builder(a) {
  Builder(
    spec: CommandSpec,
    encoders: endec.Encoders,
    decoder: endec.Decoder(a),
  )
}

Constructors

  • Builder(
      spec: CommandSpec,
      encoders: endec.Encoders,
      decoder: endec.Decoder(a),
    )
pub type BuilderFn(a) =
  fn(Builder(Nil)) -> BuildResult(Builder(a))
pub type Command(a, b) =
  fn(Continuation(a, b)) -> BuilderFn(b)
pub type CommandSpec {
  CommandSpec(
    flags: dict.Dict(String, FlagSpec),
    named: dict.Dict(String, NamedSpec),
    args: List(ArgSpec),
    subcommands: dict.Dict(String, CommandSpec),
    description: option.Option(String),
  )
}

Constructors

  • CommandSpec(
      flags: dict.Dict(String, FlagSpec),
      named: dict.Dict(String, NamedSpec),
      args: List(ArgSpec),
      subcommands: dict.Dict(String, CommandSpec),
      description: option.Option(String),
    )
pub type Continuation(a, b) =
  fn(endec.DecodeBuilder(a, b)) -> BuilderFn(b)
pub type FlagSpec {
  FlagSpec(
    short: option.Option(String),
    long: option.Option(String),
    display: option.Option(String),
    count: Bool,
    help: String,
  )
}

Constructors

  • FlagSpec(
      short: option.Option(String),
      long: option.Option(String),
      display: option.Option(String),
      count: Bool,
      help: String,
    )
pub type NamedSpec {
  NamedSpec(
    short: option.Option(String),
    long: option.Option(String),
    display: option.Option(String),
    repeated: Bool,
    optional: Bool,
    help: String,
  )
}

Constructors

  • NamedSpec(
      short: option.Option(String),
      long: option.Option(String),
      display: option.Option(String),
      repeated: Bool,
      optional: Bool,
      help: String,
    )

Functions

pub fn command(
  define: fn(CommandSpec) -> Result(CommandSpec, String),
  validate: fn(ValidatorInput) -> Result(a, ParseError),
  decode: fn(Dynamic) -> Result(a, List(DecodeError)),
) -> fn(
  fn(fn(fn(a) -> Decoder(b)) -> Decoder(b)) ->
    fn(Builder(Nil)) -> Result(Builder(b), String),
) -> fn(Builder(Nil)) -> Result(Builder(b), String)
pub fn describe(
  description: String,
  cont: fn(Builder(Nil)) -> Result(Builder(a), String),
) -> fn(Builder(Nil)) -> Result(Builder(a), String)
pub fn new() -> CommandSpec
pub fn return(
  decoder: Decoder(a),
) -> fn(Builder(Nil)) -> Result(Builder(a), String)
Search Document