dev_tools/internals/cli

The cli module is how we create “scripts” that are intended to be run from the command line.

Types

pub opaque type Cli(a)

Functions

pub fn do(step: Cli(a), then next: fn(a) -> Cli(b)) -> Cli(b)
pub fn from_result(result: Result(a, Error)) -> Cli(a)
pub fn get_bool(
  name: String,
  fallback: Bool,
  namespace: List(String),
  flag: fn(Flags) -> Result(Bool, a),
) -> Cli(Bool)
pub fn get_config() -> Cli(Config)
pub fn get_config_value(
  name: String,
  fallback: a,
  namespace: List(String),
  toml: fn(Dict(String, Toml), List(String)) -> Result(a, b),
  flag: fn(Flags) -> Result(a, c),
) -> Cli(a)
pub fn get_flags() -> Cli(Flags)
pub fn get_int(
  name: String,
  fallback: Int,
  namespace: List(String),
  flag: fn(Flags) -> Result(Int, a),
) -> Cli(Int)
pub fn get_name() -> Cli(String)
pub fn get_string(
  name: String,
  fallback: String,
  namespace: List(String),
  flag: fn(Flags) -> Result(String, a),
) -> Cli(String)
pub fn in(value: fn() -> a) -> Cli(a)
pub fn log(message: String, then next: fn() -> Cli(a)) -> Cli(a)
pub fn map(step: Cli(a), then next: fn(a) -> b) -> Cli(b)
pub fn mute() -> Cli(Nil)
pub fn notify(
  message: String,
  then next: fn() -> Cli(a),
) -> Cli(a)
pub fn return(value: a) -> Cli(a)
pub fn run(step: Cli(a), flags: Flags) -> Result(a, Error)
pub fn success(
  message: String,
  then next: fn() -> Cli(a),
) -> Cli(a)
pub fn template(
  name: String,
  then next: fn(String) -> Cli(a),
) -> Cli(a)
pub fn throw(error: Error) -> Cli(a)
pub fn try(
  result: Result(a, Error),
  then next: fn(a) -> Cli(b),
) -> Cli(b)
pub fn unmute() -> Cli(Nil)
Search Document