From 67bca6336c0733be08dbf4f72243526370b3913c Mon Sep 17 00:00:00 2001 From: Zynh0722 Date: Wed, 31 Jan 2024 16:33:35 -0800 Subject: [PATCH] remove already solved commit hash solved in 809fc3de61bb3f8d6d6e340ba9cd386d713dc5a1 --- src/main.rs | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/main.rs b/src/main.rs index 53ed57d..0b53bcf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -use std::process::exit; +use std::{io::ErrorKind, process::exit}; use anyhow::anyhow; @@ -25,21 +25,16 @@ fn become_wm(conn: &C, screen: &Screen) -> anyhow::Result<()> { res.map_err(|e| anyhow!(e)) } -fn handle_args() { +fn main() -> anyhow::Result<()> { let mut args = std::env::args().skip(1); if let Some(arg) = args.next() { if arg != "-v" { - eprintln!("usage: rswm [-v]"); - exit(1); + return Err(anyhow!("usage: rswm [-v]")); } else { - println!("rswm-{}", env!("CARGO_PKG_VERSION")); - exit(0); + println!(env!("CARGO_PKG_VERSION")); // TODO: test this + return Ok(()); } } -} - -fn main() -> anyhow::Result<()> { - handle_args(); // TODO: Investigate LC_CTYPE and Locale stuff from dwm