glint/flag
Types
Associates a name with a flag value
pub type Flag {
Flag(name: String, value: FlagValue)
}
Constructors
-
Flag(name: String, value: FlagValue)
Supported flag types.
pub type FlagValue {
B(Bool)
I(Int)
LI(List(Int))
F(Float)
LF(List(Float))
S(String)
LS(List(String))
}
Constructors
-
B(Bool)Boolean flags, to be passed in as
--flag=trueor--flag=false. Can be toggled by omitting the desired value like--flag. Toggling will negate the existing value. -
I(Int)Int flags, to be passed in as
--flag=1 -
LI(List(Int))List(Int) flags, to be passed in as
--flag=1,2,3 -
F(Float)Float flags, to be passed in as
--flag=1.0 -
LF(List(Float))List(Float) flags, to be passed in as
--flag=1.0,2.0 -
S(String)String flags, to be passed in as
--flag=hello -
LS(List(String))List(String) flags, to be passed in as
--flag=hello,world
Constants
Functions
pub fn bool(called name: String, default value: Bool) -> Flag
Creates a Flag(name, B(value))
pub fn build_map(flags: List(Flag)) -> Map(String, FlagValue)
Convert a list of flags to a FlagMap.
pub fn float(called name: String, default value: Float) -> Flag
Creates a Flag(name, F(value))
pub fn float_list(called name: String, default value: List(Float)) -> Flag
Creates a Flag(name, LF(value))
pub fn int_list(called name: String, default value: List(Int)) -> Flag
Creates a Flag(name, LI(value))
pub fn string(called name: String, default value: String) -> Flag
Creates a Flag(name, S(value))
pub fn string_list(called name: String, default value: List(
String,
)) -> Flag
Creates a Flag(name, LS(value))
pub fn update_flags(in flags: Map(String, FlagValue), with flag_input: String) -> Result(
Map(String, FlagValue),
Snag,
)
Updates a flag balue, 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