From e0a858214c75426dfd9cf47f38b0e596d0541784 Mon Sep 17 00:00:00 2001 From: Seaotatop Date: Mon, 19 Jun 2023 13:27:54 -0500 Subject: [PATCH] Add arguments for both winit and udev backends --- src/main.rs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/src/main.rs b/src/main.rs index 431b76a..76b6dca 100644 --- a/src/main.rs +++ b/src/main.rs @@ -28,12 +28,21 @@ fn main() -> Result<(), Box> { } let mut args = std::env::args().skip(1); - if let Some("--winit") = args.next().as_deref() { - tracing::info!("Starting winit backend"); - crate::backend::winit::run_winit()?; - } else { - tracing::info!("Starting udev backend"); - crate::backend::udev::run_udev()?; + match args.next().as_deref() { + Some("--winit") => { + tracing::info!("Starting winit backend"); + crate::backend::winit::run_winit()?; + } + Some("--udev") => { + tracing::info!("Starting udev backend"); + crate::backend::udev::run_udev()?; + } + Some(arg) => tracing::error!("Unknown argument {}", arg), + None => { + println!( + "Specify a backend:\n\t--udev to launch Pinnacle in a tty, or\n\t--winit to launch Pinnacle as an ordinary window in your graphical environment." + ); + } } Ok(())