gxyz/cli

Types

pub type FailOpt {
  FailOptMessage(String)
  FailOptExitCode(Int)
  FailOptEcho
}

Constructors

  • FailOptMessage(String)
  • FailOptExitCode(Int)
  • FailOptEcho

Values

pub fn custom_hard_fail(
  res: Result(a, b),
  options: List(FailOpt),
) -> a
pub fn hard_fail(res: Result(a, b)) -> a

Hard exit the program if the result is an Error and return the value if an Ok, exit 1, without a message

pub fn hard_fail_with_msg(res: Result(a, b), msg: String) -> a

Hard exit the program if the result is an Error and return the value if an Ok, with the exit 1 and printing msg to stderror

pub fn hard_fail_with_opts(
  res: Result(a, b),
  msg: String,
  status_code: Int,
) -> a

Deprecated: Please use `custom_hard_fail/2` instead

Hard exit the program if the result is an Error and return the value if an Ok, with the exit code and printing msg to stderror

pub fn strip_js_from_argv(args: List(String)) -> List(String)

strip js/ts files from argv (often present in node and deno implementation)

Search Document