tokfit/cli

The tokfit command.

Emits a single line of JSON on stdout. Bad usage leaves stdout empty, writes the usage string to stderr, and exits 1. There is no OTP process and no FFI, so the runtime’s panic message and stack trace accompany the usage string, 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