tokfit/cli

The tokfit command.

Emits a single line of JSON on stdout. Bad usage prints the usage string and exits 1. There is no OTP process and no FFI, so every failure exits 1 and no finer-grained codes are available; they are not worth the machinery they would need.

Values

pub fn escape_json(input: String) -> String

Escape input for use inside a JSON string, without the surrounding quotes. Non-ASCII is passed through, which JSON allows.

pub fn main() -> Nil

Entry point.

pub fn try_run(arguments: List(String)) -> Result(String, String)

Run one command over arguments, returning the JSON line or an error message.

arguments is argv.load().arguments, which is the command line with the program name already removed, so the command is the first element.

✨ Search Document