diff --git a/installer/src/lib.rs b/installer/src/lib.rs index 12b02e0..5317129 100644 --- a/installer/src/lib.rs +++ b/installer/src/lib.rs @@ -313,9 +313,13 @@ pub fn run_with_callback<'a>( .context("Failed to create Tokio runtime")? .block_on(async { let args = std::iter::once("installer").chain(args); - let parsed_args = Args::try_parse_from(args).context("Failed to parse arguments")?; - - run(parsed_args).await + match Args::try_parse_from(args) { + Ok(parsed_args) => run(parsed_args).await, + Err(e) => { + eprintln!("{}", e); + Ok(()) + } + } }) } @@ -323,12 +327,3 @@ pub fn run_with_callback<'a>( pub fn version() -> &'static str { env!("CARGO_PKG_VERSION") } - -/// Run the CLI installer -/// -/// This function is public so the binary can call it, but library users -/// should use the typed functions like `run_with_callback` instead. -pub async fn main_cli() -> Result<(), Error> { - let args = Args::parse(); - run(args).await -} diff --git a/installer/src/main.rs b/installer/src/main.rs index e07c803..d7a77ad 100644 --- a/installer/src/main.rs +++ b/installer/src/main.rs @@ -1,6 +1,7 @@ -#[tokio::main(flavor = "current_thread")] -async fn main() { - if let Err(e) = installer::main_cli().await { +fn main() { + let args: Vec = std::env::args().skip(1).collect(); + + if let Err(e) = installer::run_with_callback(args.iter().map(|s| s.as_str()), None) { eprintln!("{e:?}"); std::process::exit(1); }