use std::env::args_os;
use std::ffi::OsStr;
use std::path::Path;
use std::process::exit;
use anyhow::Context;
fn main() -> millennium_cli::Result<()> {
let mut args = args_os().peekable();
let bin_name = match args.next().as_deref().map(Path::new).and_then(Path::file_stem).and_then(OsStr::to_str) {
Some("cargo-millennium") => {
if args.peek().and_then(|s| s.to_str()) == Some("millennium") {
args.next();
Some("cargo millennium".into())
} else {
Some("cargo-millennium".into())
}
}
Some(stem) => Some(stem.to_string()),
None => {
eprintln!("cargo-millennium wrapper unable to read first argument");
exit(1);
}
};
millennium_cli::run(args, bin_name).context("Try running with --verbose to see command output")
}