Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/holger

holger-cli/src/main.rs

//! `holger-cli`: see the crate docs (`lib.rs`).

use clap::Parser as _;

#[tokio::main]
async fn main() {
    let cli = match holger_cli::cli::Cli::try_parse() {
        Ok(c) => c,
        // `--help` and `--version` are answers, not failures.
        Err(e) if !e.use_stderr() => {
            let _ = e.print();
            return;
        }
        Err(e) => {
            eprintln!(
                "{}",
                holger_cli::CliError::InvalidArgs(e.to_string().trim().to_owned())
            );
            std::process::exit(2);
        }
    };
    match holger_cli::run::run(cli, |k| std::env::var(k).ok()).await {
        Ok(out) => print!("{out}"),
        Err(e) => {
            eprintln!("{e}");
            std::process::exit(e.exit_code());
        }
    }
}