~ knotless Search/
↑↓ move↵ open⇧↵ all results

johnandersen777.bsky.social/knotless

git that lives in your Atmosphere account

Forked from chadtmiller.com/knotless

0
0
28 lines · 1013 B Raw History
use std::process::ExitCode;

fn main() -> ExitCode {
    let args: Vec<String> = std::env::args().collect();
    let opts = match knotless_agent::parse_args(&args) {
        Ok(opts) => opts,
        Err(usage) => {
            eprintln!("{usage}");
            return ExitCode::from(2);
        }
    };
    // KNOTLESS_COMMIT is the commit the image was built from, set as it
    // runs (Dockerfile), so the binary is the same at every commit.
    let (version, commit) = (
        env!("CARGO_PKG_VERSION"),
        std::env::var("KNOTLESS_COMMIT").ok(),
    );
    knotless::telemetry::init("knotless-agent", version, commit.as_deref());
    let ctx = knotless::env::Ctx::new(knotless::env::Env::from_process());
    let runtime = tokio::runtime::Runtime::new().expect("a runtime builds");
    match runtime.block_on(knotless_agent::run(opts, ctx)) {
        Ok(()) => ExitCode::SUCCESS,
        Err(err) => {
            eprintln!("knotless-agent: {err:#}");
            ExitCode::FAILURE
        }
    }
}