Add arguments for both winit and udev backends

This commit is contained in:
Seaotatop 2023-06-19 13:27:54 -05:00
parent 07d3c3c7fc
commit e0a858214c

View file

@ -28,13 +28,22 @@ fn main() -> Result<(), Box<dyn Error>> {
} }
let mut args = std::env::args().skip(1); let mut args = std::env::args().skip(1);
if let Some("--winit") = args.next().as_deref() { match args.next().as_deref() {
Some("--winit") => {
tracing::info!("Starting winit backend"); tracing::info!("Starting winit backend");
crate::backend::winit::run_winit()?; crate::backend::winit::run_winit()?;
} else { }
Some("--udev") => {
tracing::info!("Starting udev backend"); tracing::info!("Starting udev backend");
crate::backend::udev::run_udev()?; 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(()) Ok(())
} }