mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-23 21:55:11 +02:00
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(use_old_network_legend)
|
||||||
.arg(whole_word);
|
.arg(whole_word);
|
||||||
|
|
||||||
let app = if cfg!(feature = "battery") {
|
if cfg!(feature = "battery") {
|
||||||
let battery = Arg::new("battery")
|
let battery = Arg::new("battery")
|
||||||
.long("battery")
|
.long("battery")
|
||||||
.help("Shows the battery widget.")
|
.help("Shows the battery widget.")
|
||||||
@ -402,7 +402,5 @@ use CPU (3) as the default instead.
|
|||||||
app.arg(battery)
|
app.arg(battery)
|
||||||
} else {
|
} else {
|
||||||
app
|
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 {
|
fn get_use_battery(matches: &clap::ArgMatches, config: &Config) -> bool {
|
||||||
if matches.is_present("battery") {
|
if cfg!(feature = "battery") {
|
||||||
return true;
|
if matches.is_present("battery") {
|
||||||
} else if let Some(flags) = &config.flags {
|
return true;
|
||||||
if let Some(battery) = flags.battery {
|
} else if let Some(flags) = &config.flags {
|
||||||
return battery;
|
if let Some(battery) = flags.battery {
|
||||||
|
return battery;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
false
|
false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user