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 BuildError =
String
pub type BuildResult(a) =
Result(Builder(a), BuildError)
pub type Builder(a) {
Builder(spec: CommandSpec, validator: Validator(a))
}
Constructors
-
Builder(spec: CommandSpec, validator: Validator(a))
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(Validator(a)) -> 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, )
pub type ValidationError =
String
pub type ValidationResult(a) =
Result(a, ValidationError)
pub type ValidatorInput {
ValidatorInput(
flags: dict.Dict(String, Int),
named: dict.Dict(String, List(String)),
args: List(String),
subcommands: dict.Dict(String, ValidatorInput),
)
}
Constructors
-
ValidatorInput( flags: dict.Dict(String, Int), named: dict.Dict(String, List(String)), args: List(String), subcommands: dict.Dict(String, ValidatorInput), )
Functions
pub fn command(
builder: fn(CommandSpec) -> Result(Builder(a), String),
) -> fn(
fn(fn(ValidatorInput) -> Result(a, String)) ->
fn(CommandSpec) -> Result(Builder(b), String),
) -> fn(CommandSpec) -> Result(Builder(b), String)
pub fn describe(
description: String,
cont: fn(CommandSpec) -> Result(Builder(a), String),
) -> fn(CommandSpec) -> Result(Builder(a), String)