glint/flag

Types

pub type Contents {
  Contents(value: Value, description: Description)
}

Constructors

  • Contents(value: Value, description: Description)
pub type Description =
  String
pub type Flag =
  #(String, Contents)
pub type Map =
  map.Map(String, Contents)
pub type Value {
  B(Bool)
  I(Int)
  LI(List(Int))
  F(Float)
  LF(List(Float))
  S(String)
  LS(List(String))
}

Constructors

  • B(Bool)
  • I(Int)
  • LI(List(Int))
  • F(Float)
  • LF(List(Float))
  • S(String)
  • LS(List(String))

Constants

pub const prefix: String = "--"

Flag inputs must start with this prefix

Functions

pub fn bool(called name: String, default value: Bool, explained description: String) -> #(
  String,
  Contents,
)
pub fn build_map(flags: List(#(String, Contents))) -> Map(
  String,
  Contents,
)
pub fn flags_help(flags: Map(String, Contents)) -> String
pub fn float(called name: String, default value: Float, explained description: String) -> #(
  String,
  Contents,
)
pub fn floats(called name: String, default value: List(Float), explained description: String) -> #(
  String,
  Contents,
)
pub fn get_value(flags: Map(String, Contents), name: String) -> Result(
  Value,
  Nil,
)
pub fn help_flag() -> String
pub fn int(called name: String, default value: Int, explained description: String) -> #(
  String,
  Contents,
)
pub fn ints(called name: String, default value: List(Int), explained description: String) -> #(
  String,
  Contents,
)
pub fn string(called name: String, default value: String, explained description: String) -> #(
  String,
  Contents,
)
pub fn strings(called name: String, default value: List(String), explained description: String) -> #(
  String,
  Contents,
)
pub fn update_flags(in flags: Map(String, Contents), with flag_input: String) -> Result(
  Map(String, Contents),
  Snag,
)