iskra 0.2.4

A safe, modern, Rust-native data transfer tool.
Documentation
use iskra::cli::run_cli;
use iskra::cli_args::Cli;
// use iskra::IskraError; // No longer needed directly
use clap::Parser;

/// Entry point for the Iskra application.
// This function initialises the asynchronous runtime and executes the CLI.
#[tokio::main]
async fn main() {
    // Run the CLI and handle any errors gracefully.
    // Parse CLI args first to check for --verbose-errors
    let reordered_args = iskra::cli_parser::reorder_global_options(std::env::args_os());
    let cli = Cli::parse_from(&reordered_args);
    let verbose_flag = cli.global.verbose_errors;
    if let Err(e) = run_cli().await {
        let verbose_env = std::env::var_os("ISKRA_ERROR_VERBOSE").is_some();
        if verbose_flag || verbose_env {
            e.print_report();
        } else {
            eprintln!("\x1b[1;31mIskra Error:\x1b[0m {e}");
        }
        std::process::exit(1);
    }
}