bug: fix panic if battery feature was disabled
This commit is contained in:
parent
8cc361e443
commit
a92313a5be
|
@ -392,7 +392,7 @@ use CPU (3) as the default instead.
|
|||
.arg(use_old_network_legend)
|
||||
.arg(whole_word);
|
||||
|
||||
let app = if cfg!(feature = "battery") {
|
||||
if cfg!(feature = "battery") {
|
||||
let battery = Arg::new("battery")
|
||||
.long("battery")
|
||||
.help("Shows the battery widget.")
|
||||
|
@ -402,7 +402,5 @@ use CPU (3) as the default instead.
|
|||
app.arg(battery)
|
||||
} else {
|
||||
app
|
||||
};
|
||||
|
||||
app
|
||||
}
|
||||
}
|
||||
|
|
|
@ -916,11 +916,13 @@ fn get_hide_table_gap(matches: &clap::ArgMatches, config: &Config) -> bool {
|
|||
}
|
||||
|
||||
fn get_use_battery(matches: &clap::ArgMatches, config: &Config) -> bool {
|
||||
if matches.is_present("battery") {
|
||||
return true;
|
||||
} else if let Some(flags) = &config.flags {
|
||||
if let Some(battery) = flags.battery {
|
||||
return battery;
|
||||
if cfg!(feature = "battery") {
|
||||
if matches.is_present("battery") {
|
||||
return true;
|
||||
} else if let Some(flags) = &config.flags {
|
||||
if let Some(battery) = flags.battery {
|
||||
return battery;
|
||||
}
|
||||
}
|
||||
}
|
||||
false
|
||||
|
|
Loading…
Reference in New Issue