narrate

Crates.io msrv
1.61.1 tests Documentation license

This library provides CLI application error and status reporting utilities. The coloured output formatting aims to be similar to [Cargo]. Error type is a wrapper around [anyhow], with optional help messages.

Features

How to use

Please view the API Docs and examples for more information.

FAQ

Should I use narrate instead of [anyhow] or [eyre]?

Anyhow is a great tool for handling errors in your CLI app, but it doesn't come with its own reporting, common set of errors, or the ability to add separate help messages.

Eyre and its companion crates offer fine-grained error reporting and is far more customizable than narrate - which is opinionated in copying Cargo's style. If you don't need that much control, narrate provides a simpler alternative. Plus the added benefit of reporting statuses, not just errors.

Can I just pretty print my [anyhow] errors?

If you just use the report Cargo feature flag, you can access the report module and thus the anyhow_err and anyhow_err_full functions.

```toml

Cargo.toml

[dependencies] narrate = { version = "0.4.0", default-features = false, features = ["report"] } ```

```rust // main.rs use narrate::report;

fn main() { if let Err(err) => run() { report::anyhowerrfull(err);
} }

fn run() -> anyhow::Result<()> { ... } ```

Contributing

Thank you very much for considering to contribute to this project!

We welcome any form of contribution:

Note: Before you take the time to open a pull request, please open an issue first.

See CONTRIBUTING.md for details.

License

narrate is distributed under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE and LICENSE-MIT for details.