Changed debug option names

* --debug-json -> --debug
* --debug-modules -> --debug-icons
This commit is contained in:
Mahesh Asolkar 2025-06-06 17:57:14 -07:00
parent c84e9698d7
commit 750a2813d3
Signed by: asolkar
GPG Key ID: 371CA8164433BDCC
6 changed files with 15 additions and 15 deletions

View File

@ -125,7 +125,7 @@ impl bar_modules::BarModuleActions for UnibarModuleCpu {
thread::sleep(Duration::from_millis(1000)); thread::sleep(Duration::from_millis(1000));
self.cpu_times_sample_2 = self.read_cpu_times().expect("REASON"); 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 1 - {:#?}", self.cpu_times_sample_1);
println!("-----> CPU times sample 2 - {:#?}", self.cpu_times_sample_2); 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 caps = re.captures(self.procstat_str.as_str()).unwrap();
// let cpu_line = caps.get(0).unwrap().as_str(); // let cpu_line = caps.get(0).unwrap().as_str();
// if self.opts.debug_json { // if self.opts.debug {
// println!("-----> CPU line - {:#?}", cpu_line); // println!("-----> CPU line - {:#?}", cpu_line);
// } // }

View File

@ -37,7 +37,7 @@ impl bar_modules::BarModuleActions for UnibarModuleMemory {
match meminfo_file.read_to_string(&mut self.meminfo_str) { match meminfo_file.read_to_string(&mut self.meminfo_str) {
Err(why) => panic!("couldn't read {}: {}", path.display(), why), 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); println!("-----> meminfo - {:#?}", self.meminfo_str);
}, },
}; };

View File

@ -41,7 +41,7 @@ impl bar_modules::BarModuleActions for UnibarModuleNetwork {
let network_data: Value = serde_json::from_str::<Value>(self.ip_addr_stdout.as_str()).unwrap(); let network_data: Value = serde_json::from_str::<Value>(self.ip_addr_stdout.as_str()).unwrap();
if let Some(interfaces) = network_data.as_array() { if let Some(interfaces) = network_data.as_array() {
if self.opts.debug_json { if self.opts.debug {
println!("-----> network_data - {:#?}", network_data); println!("-----> network_data - {:#?}", network_data);
} }
// Get all interfaces that are up // 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")) .filter(|ai| ai["scope"].as_str().unwrap().contains("global"))
.cloned().collect(); .cloned().collect();
if inet_addr.len() > 0 { if inet_addr.len() > 0 {
if self.opts.debug_json { if self.opts.debug {
println!("-----> Inet Addr - {:#?}", inet_addr); println!("-----> Inet Addr - {:#?}", inet_addr);
} }
self.network_info = inet_addr[0].clone(); 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); println!("-----> ip_addr - {:#?}", self.network_info);
} }
} }

View File

@ -175,7 +175,7 @@ impl bar_modules::BarModuleActions for UnibarModuleWeather {
}).unwrap(); }).unwrap();
transfer.perform().unwrap(); transfer.perform().unwrap();
} }
if self.opts.debug_json { if self.opts.debug {
println!("-----> curl_data - [{}]", std::str::from_utf8(&curl_ret).unwrap()); println!("-----> curl_data - [{}]", std::str::from_utf8(&curl_ret).unwrap());
} }

View File

@ -26,6 +26,6 @@ pub struct AppOptions {
pub weather_units: TemperatureUnits, pub weather_units: TemperatureUnits,
pub weather_station: String, pub weather_station: String,
pub music_progress: bool, pub music_progress: bool,
pub debug_json: bool, pub debug: bool,
pub debug_modules: bool, pub debug_icons: bool,
} }

View File

@ -28,11 +28,11 @@ struct CommandlineArgs {
/// Show JSON data returned by query /// Show JSON data returned by query
#[arg(short = 'D', long)] #[arg(short = 'D', long)]
debug_json: bool, debug: bool,
/// Show ICON debug information /// Show ICON debug information
#[arg(short = 'I', long)] #[arg(short = 'I', long)]
debug_modules: bool, debug_icons: bool,
} }
// //
@ -46,7 +46,7 @@ struct Unibar {
impl Unibar { impl Unibar {
// -------------------- // --------------------
fn run(&self) { fn run(&self) {
if self.opts.debug_json { if self.opts.debug {
self.debug_msg("Debugging ..."); self.debug_msg("Debugging ...");
} }
self.check_options(); self.check_options();
@ -80,7 +80,7 @@ impl Unibar {
} }
// Show module debug information if enabled // Show module debug information if enabled
if self.opts.debug_modules { if self.opts.debug_icons {
let bar_modules_debugged: Vec<Box<dyn bar_modules::BarModuleDebug>> = vec! [ let bar_modules_debugged: Vec<Box<dyn bar_modules::BarModuleDebug>> = vec! [
Box::new(bar_modules::bar_module_weather::UnibarModuleWeather::new(self.opts.clone())), Box::new(bar_modules::bar_module_weather::UnibarModuleWeather::new(self.opts.clone())),
Box::new(bar_modules::bar_module_music::UnibarModuleMusic::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 }, else { common::TemperatureUnits::Imperial },
weather_station: cmd_args.weather_station, weather_station: cmd_args.weather_station,
music_progress: cmd_args.music_progress, music_progress: cmd_args.music_progress,
debug_json: cmd_args.debug_json, debug: cmd_args.debug,
debug_modules: cmd_args.debug_modules debug_icons: cmd_args.debug_icons
}, },
}; };