diff --git a/src/bar_modules/bar_module_cpu.rs b/src/bar_modules/bar_module_cpu.rs index 4580c5d..3677251 100644 --- a/src/bar_modules/bar_module_cpu.rs +++ b/src/bar_modules/bar_module_cpu.rs @@ -125,7 +125,7 @@ impl bar_modules::BarModuleActions for UnibarModuleCpu { thread::sleep(Duration::from_millis(1000)); self.cpu_times_sample_2 = self.read_cpu_times().expect("REASON"); - if self.opts.debug_json { + if self.opts.debug { println!("-----> CPU times sample 1 - {:#?}", self.cpu_times_sample_1); println!("-----> CPU times sample 2 - {:#?}", self.cpu_times_sample_2); } @@ -152,7 +152,7 @@ impl bar_modules::BarModuleActions for UnibarModuleCpu { // let caps = re.captures(self.procstat_str.as_str()).unwrap(); // let cpu_line = caps.get(0).unwrap().as_str(); - // if self.opts.debug_json { + // if self.opts.debug { // println!("-----> CPU line - {:#?}", cpu_line); // } diff --git a/src/bar_modules/bar_module_memory.rs b/src/bar_modules/bar_module_memory.rs index 888fc1c..a2d4227 100644 --- a/src/bar_modules/bar_module_memory.rs +++ b/src/bar_modules/bar_module_memory.rs @@ -37,7 +37,7 @@ impl bar_modules::BarModuleActions for UnibarModuleMemory { match meminfo_file.read_to_string(&mut self.meminfo_str) { Err(why) => panic!("couldn't read {}: {}", path.display(), why), - Ok(_) => if self.opts.debug_json { + Ok(_) => if self.opts.debug { println!("-----> meminfo - {:#?}", self.meminfo_str); }, }; diff --git a/src/bar_modules/bar_module_network.rs b/src/bar_modules/bar_module_network.rs index 235250d..296bfea 100644 --- a/src/bar_modules/bar_module_network.rs +++ b/src/bar_modules/bar_module_network.rs @@ -41,7 +41,7 @@ impl bar_modules::BarModuleActions for UnibarModuleNetwork { let network_data: Value = serde_json::from_str::(self.ip_addr_stdout.as_str()).unwrap(); if let Some(interfaces) = network_data.as_array() { - if self.opts.debug_json { + if self.opts.debug { println!("-----> network_data - {:#?}", network_data); } // Get all interfaces that are up @@ -58,7 +58,7 @@ impl bar_modules::BarModuleActions for UnibarModuleNetwork { .filter(|ai| ai["scope"].as_str().unwrap().contains("global")) .cloned().collect(); if inet_addr.len() > 0 { - if self.opts.debug_json { + if self.opts.debug { println!("-----> Inet Addr - {:#?}", inet_addr); } self.network_info = inet_addr[0].clone(); @@ -66,7 +66,7 @@ impl bar_modules::BarModuleActions for UnibarModuleNetwork { } } } - if self.opts.debug_json { + if self.opts.debug { println!("-----> ip_addr - {:#?}", self.network_info); } } diff --git a/src/bar_modules/bar_module_weather.rs b/src/bar_modules/bar_module_weather.rs index b3a4291..6402e55 100644 --- a/src/bar_modules/bar_module_weather.rs +++ b/src/bar_modules/bar_module_weather.rs @@ -175,7 +175,7 @@ impl bar_modules::BarModuleActions for UnibarModuleWeather { }).unwrap(); transfer.perform().unwrap(); } - if self.opts.debug_json { + if self.opts.debug { println!("-----> curl_data - [{}]", std::str::from_utf8(&curl_ret).unwrap()); } diff --git a/src/common/mod.rs b/src/common/mod.rs index 5988d3c..8998065 100644 --- a/src/common/mod.rs +++ b/src/common/mod.rs @@ -26,6 +26,6 @@ pub struct AppOptions { pub weather_units: TemperatureUnits, pub weather_station: String, pub music_progress: bool, - pub debug_json: bool, - pub debug_modules: bool, + pub debug: bool, + pub debug_icons: bool, } diff --git a/src/main.rs b/src/main.rs index bd71e48..257ff4a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -28,11 +28,11 @@ struct CommandlineArgs { /// Show JSON data returned by query #[arg(short = 'D', long)] - debug_json: bool, + debug: bool, /// Show ICON debug information #[arg(short = 'I', long)] - debug_modules: bool, + debug_icons: bool, } // @@ -46,7 +46,7 @@ struct Unibar { impl Unibar { // -------------------- fn run(&self) { - if self.opts.debug_json { + if self.opts.debug { self.debug_msg("Debugging ..."); } self.check_options(); @@ -80,7 +80,7 @@ impl Unibar { } // Show module debug information if enabled - if self.opts.debug_modules { + if self.opts.debug_icons { let bar_modules_debugged: Vec> = vec! [ Box::new(bar_modules::bar_module_weather::UnibarModuleWeather::new(self.opts.clone())), Box::new(bar_modules::bar_module_music::UnibarModuleMusic::new(self.opts.clone())), @@ -124,8 +124,8 @@ fn main() { else { common::TemperatureUnits::Imperial }, weather_station: cmd_args.weather_station, music_progress: cmd_args.music_progress, - debug_json: cmd_args.debug_json, - debug_modules: cmd_args.debug_modules + debug: cmd_args.debug, + debug_icons: cmd_args.debug_icons }, };