glint/flag
Types
Flag data and descriptions
pub type Contents {
Contents(value: Value, description: Description)
}
Constructors
-
Contents(value: Value, description: Description)
Flag descriptions
pub type Description =
String
FlagOpt is used for configuring flag creation.
pub type FlagOpt(a) {
WithDefault(a)
WithConstraint(Constraint(a))
}
Constructors
-
WithDefault(a)
-
WithConstraint(Constraint(a))
Constants
Functions
pub fn bool(called name: String, default value: Option(Bool), explained description: String) -> #(
String,
Contents,
)
Creates a bool flag.
pub fn build_map(flags: List(#(String, Contents))) -> Map(
String,
Contents,
)
Convert a list of flags to a Map.
pub fn flag_type_help(flag: #(String, Contents)) -> String
Generate the help message contents for a single flag
pub fn flags_help(flags: Map(String, Contents)) -> List(String)
Generate help messages for all flags
pub fn float(called name: String, explained description: String, with opts: List(
FlagOpt(Float),
)) -> #(String, Contents)
Creates a float flag.
pub fn floats(called name: String, explained description: String, with opts: List(
FlagOpt(List(Float)),
)) -> #(String, Contents)
Creates a float list flag.
pub fn get_bool(from flags: Map(String, Contents), for name: String) -> Result(
Bool,
Snag,
)
Gets the current value for the associated bool flag
pub fn get_bool_value(from flag: #(String, Contents)) -> Result(
Bool,
Snag,
)
Gets the current value for the provided bool flag
pub fn get_float(from flags: Map(String, Contents), for name: String) -> Result(
Float,
Snag,
)
Gets the current value for the associated float flag
pub fn get_float_value(from flag: #(String, Contents)) -> Result(
Float,
Snag,
)
Gets the current value for the provided float flag
pub fn get_floats(from flags: Map(String, Contents), for name: String) -> Result(
List(Float),
Snag,
)
Gets the current value for the associated floats flag
pub fn get_floats_value(from flag: #(String, Contents)) -> Result(
List(Float),
Snag,
)
Gets the current value for the provided floats flag
pub fn get_int(from flags: Map(String, Contents), for name: String) -> Result(
Int,
Snag,
)
Gets the current value for the associated int flag
pub fn get_int_value(from flag: #(String, Contents)) -> Result(
Int,
Snag,
)
Gets the current value for the provided int flag
pub fn get_ints(from flags: Map(String, Contents), for name: String) -> Result(
List(Int),
Snag,
)
Gets the current value for the associated ints flag
pub fn get_ints_value(from flag: #(String, Contents)) -> Result(
List(Int),
Snag,
)
Gets the current value for the provided ints flag
pub fn get_string(from flags: Map(String, Contents), for name: String) -> Result(
String,
Snag,
)
Gets the current value for the associated string flag
pub fn get_string_value(from flag: #(String, Contents)) -> Result(
String,
Snag,
)
Gets the current value for the provided string flag
pub fn get_strings(from flags: Map(String, Contents), for name: String) -> Result(
List(String),
Snag,
)
Gets the current value for the associated strings flag
pub fn get_strings_value(from flag: #(String, Contents)) -> Result(
List(String),
Snag,
)
Gets the current value for the provided strings flag
pub fn int(called name: String, explained description: String, with opts: List(
FlagOpt(Int),
)) -> #(String, Contents)
Creates an int flag.
pub fn ints(called name: String, explained description: String, with opts: List(
FlagOpt(List(Int)),
)) -> #(String, Contents)
Creates an int list flag.
pub fn string(called name: String, explained description: String, with opts: List(
FlagOpt(String),
)) -> #(String, Contents)
Creates a string flag.
pub fn strings(called name: String, explained description: String, with opts: List(
FlagOpt(List(String)),
)) -> #(String, Contents)
Creates a string list flag.
pub fn update_flags(in flags: Map(String, Contents), with flag_input: String) -> Result(
Map(String, Contents),
Snag,
)
Updates a flag value, ensuring that the new value can satisfy the required type. Assumes that all flag inputs passed in start with – This function is only intended to be used from glint.execute_root