vanta 0.0.14

Vanta — every developer tool, one command. The main CLI binary.
Documentation
//! Vanta — every developer tool, one command.
//!
//! This crate is the `vanta` command-line binary. It is a thin entry point over
//! [`vanta_cli`]: it collects process arguments, dispatches to the command
//! implementations, and maps the result to a process exit code. The `vt` binary
//! is an identical short alias.
//!
//! The interesting logic lives in the workspace libraries — `vanta-cli`
//! (command surface), `vanta-resolve` (version resolution), `vanta-registry`
//! (the signed index), `vanta-install` (fetch/verify/extract/build/store), and
//! friends. See `docs/04-cli.md` for the full command reference.
#![forbid(unsafe_code)]

use std::process::ExitCode;

/// Run the vanta CLI using this process's command-line arguments. Returns the
/// process exit code. This is the entry point both the `vanta` and `vt`
/// binaries call.
#[must_use]
pub fn run() -> ExitCode {
    let args: Vec<String> = std::env::args().skip(1).collect();
    run_with(&args)
}

/// Run the vanta CLI with an explicit argument list (everything after the
/// program name). Useful for tests and embedding.
#[must_use]
pub fn run_with(args: &[String]) -> ExitCode {
    match vanta_cli::run(args) {
        Ok(code) => ExitCode::from(code.as_i32() as u8),
        Err(err) => {
            eprintln!("{err}");
            ExitCode::from(err.exit().as_i32() as u8)
        }
    }
}