Changed debug option names
* --debug-json -> --debug * --debug-modules -> --debug-icons
This commit is contained in:
parent
c84e9698d7
commit
750a2813d3
@ -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);
|
||||
// }
|
||||
|
||||
|
@ -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);
|
||||
},
|
||||
};
|
||||
|
@ -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();
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
}
|
||||
|
12
src/main.rs
12
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<Box<dyn bar_modules::BarModuleDebug>> = 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
|
||||
},
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user