olpat-cli 0.10.0

A CLI for the olpat TOML toolkit (a maintained fork of taplo)
Documentation
use clap::Parser;
use std::process::exit;
use olpat_cli::{
    args::{Colors, TaploArgs},
    Taplo,
};
use olpat_common::{environment::native::NativeEnvironment, log::setup_stderr_logging};
use tracing::Instrument;

#[tokio::main]
async fn main() {
    let cli = TaploArgs::parse();
    setup_stderr_logging(
        NativeEnvironment::new(),
        cli.log_spans,
        cli.verbose,
        match cli.colors {
            Colors::Auto => None,
            Colors::Always => Some(true),
            Colors::Never => Some(false),
        },
    );

    match Taplo::new(NativeEnvironment::new())
        .execute(cli)
        .instrument(tracing::info_span!("olpat"))
        .await
    {
        Ok(_) => {
            exit(0);
        }
        Err(error) => {
            tracing::error!(error = %format!("{error:#}"), "operation failed");
            exit(1);
        }
    }
}