clip/flag
Functions for building Flag
s. A Flag
is a named option with no
associated value, such as --debug
. A Flag
produces True
when present
and False
when not present.
Types
Functions
pub fn new(name: String) -> Flag
Create a new Flag
with the provided name. Flag
s always produce a Bool
– True
if present and False
if not present.
pub fn run(
flag: Flag,
args: List(String),
) -> Result(#(Bool, List(String)), String)
Run a Flag
against a list of arguments. Used internally by clip
, not
intended for direct usage.
pub fn short(flag: Flag, short: String) -> Flag
Add a short name for the given Flag
. Short names are provided at the
command line with a single -
as a prefix.
clip.command(fn(a) { a })
|> clip.flag(flag.new("debug") |> flag.short("d"))
|> clip.run(["-d"])
// Ok(True)
pub fn to_arg_info(flag: Flag) -> ArgInfo
Used internally, not intended for direct usage.