Skip to main content

moine_cli/
lib.rs

1//! Library entrypoint for the `moine` command-line interface.
2//!
3//! The published CLI crate primarily exposes the binary target. This library
4//! target keeps the dispatcher testable while the binary remains a thin wrapper.
5
6#![deny(missing_docs)]
7
8mod archive;
9mod args;
10mod commands;
11
12#[cfg(test)]
13mod tests;
14
15/// Runs the `moine` CLI dispatcher using process arguments.
16pub fn run_from_env() {
17    if let Err(err) = commands::run_from_env() {
18        eprintln!("error: {err}");
19        std::process::exit(1);
20    }
21}
22
23/// Runs the `moine` CLI dispatcher with explicit arguments.
24pub fn run_with_args<I, S>(args: I) -> Result<(), Box<dyn std::error::Error>>
25where
26    I: IntoIterator<Item = S>,
27    S: Into<String>,
28{
29    commands::run_with_args(args)
30}