gleamunison/cli_store
A CLI owns its store handle: errors are data, and every completed action closes before its result reaches the process-exit boundary.
Values
pub fn with_dets(
path: String,
run: fn(storage.StorageAdapter) -> Result(a, String),
) -> Result(a, String)
Open a store, run the action, close the store. Errors carry a String.
pub fn with_dets_mapped(
path: String,
run: fn(storage.StorageAdapter) -> Result(a, e),
on_store_error: fn(String) -> e,
) -> Result(a, e)
Same lifecycle for a caller whose error type is richer than String — a CLI
whose exit code is part of the contract, for instance. on_store_error
lifts the store’s own failures into that type so one channel carries every
failure.