From 6eb5d01d475e03b7721f518c9d4afef8d454f4c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Benjamin=20B=C3=A4dorf?= Date: Wed, 18 Nov 2020 19:05:09 +0100 Subject: [PATCH] Add verbose option --- Cargo.toml | 2 +- src/main.rs | 31 ++++++++++++++++++++++++++----- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index c6ea853..bd374b4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wlstreamer" -version = "0.1.0" +version = "0.2.0" authors = ["Benjamin Bädorf "] edition = "2018" diff --git a/src/main.rs b/src/main.rs index 19c6fb8..fa06eca 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,6 +7,7 @@ struct Config { output: String, screen_blacklist: Vec, workspace_blacklist: Vec, + verbose: bool, } fn help() { @@ -18,6 +19,7 @@ fn help() { println!(" --not-ws Do not show this workspace. Can be used multiple times. Example: 3"); println!(" --not-screen Do not show this screen. Can be used multiple times. Example: HDMI-A-1"); println!(" -o|--output Output to this device. Defaults to /dev/video0"); + println!(" -v|--verbose Verbose logging"); println!(""); println!( "If there are no screens available for streaming, a black screen will be shown instead." @@ -42,8 +44,16 @@ fn record_screen(config: &mut Config, valid_screens: &Vec) -> Result) -> Result Vec { .filter(|s| s != "") .collect(); - println!("Found screens: {:?}", valid_screens); + println!("Found recordable screens: {:?}", valid_screens); return valid_screens; } @@ -126,6 +144,7 @@ fn main() -> Result<(), Box> { output: "/dev/video0".to_string(), screen_blacklist: Vec::new(), workspace_blacklist: Vec::new(), + verbose: false, }; let args: Vec = env::args().collect(); @@ -145,6 +164,8 @@ fn main() -> Result<(), Box> { } else if arg == "-o" || arg == "--output" { i += 1; config.output = args[i].clone(); + } else if arg == "-v" || arg == "--verbose" { + config.verbose = true; } else if arg == "-h" || arg == "--help" { help(); } else {