mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-26 23:24:20 +02:00
other: Make the battery dependency/features optional (#570)
Allows disabling of the battery dependency through a feature flag. This also aims to disable all related features.
This commit is contained in:
parent
2c8aea9eef
commit
ed07fbe1cc
10
.github/workflows/ci.yml
vendored
10
.github/workflows/ci.yml
vendored
@ -205,7 +205,15 @@ jobs:
|
|||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
command: check
|
command: check
|
||||||
args: --all-targets --verbose --target=${{ matrix.triple.target }} --no-default-features
|
args: --all-targets --verbose --target=${{ matrix.triple.target }} --features "battery"
|
||||||
|
use-cross: ${{ matrix.triple.cross }}
|
||||||
|
|
||||||
|
- name: Check without battery feature on the main 3
|
||||||
|
if: matrix.triple.toTest == 'true'
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
with:
|
||||||
|
command: check
|
||||||
|
args: --all-targets --verbose --target=${{ matrix.triple.target }}
|
||||||
use-cross: ${{ matrix.triple.cross }}
|
use-cross: ${{ matrix.triple.cross }}
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
|
2
.github/workflows/deployment.yml
vendored
2
.github/workflows/deployment.yml
vendored
@ -218,7 +218,7 @@ jobs:
|
|||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
command: build
|
command: build
|
||||||
args: --release --verbose --target=${{ matrix.triple.target }} --no-default-features
|
args: --release --verbose --target=${{ matrix.triple.target }} --features "battery"
|
||||||
use-cross: ${{ matrix.triple.cross }}
|
use-cross: ${{ matrix.triple.cross }}
|
||||||
|
|
||||||
- name: Move autocomplete to working directory
|
- name: Move autocomplete to working directory
|
||||||
|
2
.github/workflows/nightly.yml
vendored
2
.github/workflows/nightly.yml
vendored
@ -212,7 +212,7 @@ jobs:
|
|||||||
uses: actions-rs/cargo@v1
|
uses: actions-rs/cargo@v1
|
||||||
with:
|
with:
|
||||||
command: build
|
command: build
|
||||||
args: --release --verbose --target=${{ matrix.triple.target }} --no-default-features
|
args: --release --verbose --target=${{ matrix.triple.target }} --features "battery"
|
||||||
use-cross: ${{ matrix.triple.cross }}
|
use-cross: ${{ matrix.triple.cross }}
|
||||||
|
|
||||||
- name: Move autocomplete to working directory
|
- name: Move autocomplete to working directory
|
||||||
|
@ -31,12 +31,11 @@ opt-level = 3
|
|||||||
codegen-units = 1
|
codegen-units = 1
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["fern", "log"]
|
default = ["fern", "log", "battery"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
anyhow = "1.0.40"
|
anyhow = "1.0.40"
|
||||||
backtrace = "0.3.59"
|
backtrace = "0.3.59"
|
||||||
battery = "0.7.8"
|
|
||||||
chrono = "0.4.19"
|
chrono = "0.4.19"
|
||||||
crossterm = "0.18.2"
|
crossterm = "0.18.2"
|
||||||
ctrlc = { version = "3.1.9", features = ["termination"] }
|
ctrlc = { version = "3.1.9", features = ["termination"] }
|
||||||
@ -60,9 +59,10 @@ typed-builder = "0.9.0"
|
|||||||
unicode-segmentation = "1.7.1"
|
unicode-segmentation = "1.7.1"
|
||||||
unicode-width = "0.1"
|
unicode-width = "0.1"
|
||||||
|
|
||||||
# For debugging only... disable on release builds with --no-default-target for no? TODO: Redo this.
|
# For debugging only... disable on release builds with for now? TODO: Redo this.
|
||||||
fern = { version = "0.6.0", optional = true }
|
fern = { version = "0.6.0", optional = true }
|
||||||
log = { version = "0.4.14", optional = true }
|
log = { version = "0.4.14", optional = true }
|
||||||
|
battery = { version = "0.7.8", optional = true }
|
||||||
|
|
||||||
[target.'cfg(unix)'.dependencies]
|
[target.'cfg(unix)'.dependencies]
|
||||||
libc = "0.2.86"
|
libc = "0.2.86"
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
# Battery Widget
|
# Battery Widget
|
||||||
|
|
||||||
|
!!! Warning
|
||||||
|
|
||||||
|
The battery features are unavailable if the binary is compiled with the `battery` feature disabled!
|
||||||
|
|
||||||
The battery widget provides information about batteries on the system.
|
The battery widget provides information about batteries on the system.
|
||||||
|
|
||||||
<figure>
|
<figure>
|
||||||
|
@ -16,8 +16,11 @@ use once_cell::sync::Lazy;
|
|||||||
|
|
||||||
use std::{time::Instant, vec::Vec};
|
use std::{time::Instant, vec::Vec};
|
||||||
|
|
||||||
|
#[cfg(feature = "battery")]
|
||||||
|
use crate::data_harvester::batteries;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
data_harvester::{batteries, cpu, disks, memory, network, processes, temperature, Data},
|
data_harvester::{cpu, disks, memory, network, processes, temperature, Data},
|
||||||
utils::gen_util::{get_decimal_bytes, GIGA_LIMIT},
|
utils::gen_util::{get_decimal_bytes, GIGA_LIMIT},
|
||||||
};
|
};
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
@ -60,6 +63,7 @@ pub struct DataCollection {
|
|||||||
pub io_labels_and_prev: Vec<((u64, u64), (u64, u64))>,
|
pub io_labels_and_prev: Vec<((u64, u64), (u64, u64))>,
|
||||||
pub io_labels: Vec<(String, String)>,
|
pub io_labels: Vec<(String, String)>,
|
||||||
pub temp_harvest: Vec<temperature::TempHarvest>,
|
pub temp_harvest: Vec<temperature::TempHarvest>,
|
||||||
|
#[cfg(feature = "battery")]
|
||||||
pub battery_harvest: Vec<batteries::BatteryHarvest>,
|
pub battery_harvest: Vec<batteries::BatteryHarvest>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,6 +84,7 @@ impl Default for DataCollection {
|
|||||||
io_labels_and_prev: Vec::default(),
|
io_labels_and_prev: Vec::default(),
|
||||||
io_labels: Vec::default(),
|
io_labels: Vec::default(),
|
||||||
temp_harvest: Vec::default(),
|
temp_harvest: Vec::default(),
|
||||||
|
#[cfg(feature = "battery")]
|
||||||
battery_harvest: Vec::default(),
|
battery_harvest: Vec::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -97,7 +102,10 @@ impl DataCollection {
|
|||||||
self.io_harvest = disks::IoHarvest::default();
|
self.io_harvest = disks::IoHarvest::default();
|
||||||
self.io_labels_and_prev = Vec::default();
|
self.io_labels_and_prev = Vec::default();
|
||||||
self.temp_harvest = Vec::default();
|
self.temp_harvest = Vec::default();
|
||||||
self.battery_harvest = Vec::default();
|
#[cfg(feature = "battery")]
|
||||||
|
{
|
||||||
|
self.battery_harvest = Vec::default();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_frozen_time(&mut self) {
|
pub fn set_frozen_time(&mut self) {
|
||||||
@ -166,9 +174,12 @@ impl DataCollection {
|
|||||||
self.eat_proc(list_of_processes);
|
self.eat_proc(list_of_processes);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Battery
|
#[cfg(feature = "battery")]
|
||||||
if let Some(list_of_batteries) = harvested_data.list_of_batteries {
|
{
|
||||||
self.eat_battery(list_of_batteries);
|
// Battery
|
||||||
|
if let Some(list_of_batteries) = harvested_data.list_of_batteries {
|
||||||
|
self.eat_battery(list_of_batteries);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// And we're done eating. Update time and push the new entry!
|
// And we're done eating. Update time and push the new entry!
|
||||||
@ -312,6 +323,7 @@ impl DataCollection {
|
|||||||
self.process_harvest = list_of_processes;
|
self.process_harvest = list_of_processes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "battery")]
|
||||||
fn eat_battery(&mut self, list_of_batteries: Vec<batteries::BatteryHarvest>) {
|
fn eat_battery(&mut self, list_of_batteries: Vec<batteries::BatteryHarvest>) {
|
||||||
self.battery_harvest = list_of_batteries;
|
self.battery_harvest = list_of_batteries;
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ use fxhash::FxHashMap;
|
|||||||
#[cfg(not(target_os = "linux"))]
|
#[cfg(not(target_os = "linux"))]
|
||||||
use sysinfo::{System, SystemExt};
|
use sysinfo::{System, SystemExt};
|
||||||
|
|
||||||
|
#[cfg(feature = "battery")]
|
||||||
use battery::{Battery, Manager};
|
use battery::{Battery, Manager};
|
||||||
|
|
||||||
use crate::app::layout_manager::UsedWidgets;
|
use crate::app::layout_manager::UsedWidgets;
|
||||||
@ -16,6 +17,7 @@ use futures::join;
|
|||||||
|
|
||||||
use super::DataFilters;
|
use super::DataFilters;
|
||||||
|
|
||||||
|
#[cfg(feature = "battery")]
|
||||||
pub mod batteries;
|
pub mod batteries;
|
||||||
pub mod cpu;
|
pub mod cpu;
|
||||||
pub mod disks;
|
pub mod disks;
|
||||||
@ -36,6 +38,7 @@ pub struct Data {
|
|||||||
pub list_of_processes: Option<Vec<processes::ProcessHarvest>>,
|
pub list_of_processes: Option<Vec<processes::ProcessHarvest>>,
|
||||||
pub disks: Option<Vec<disks::DiskHarvest>>,
|
pub disks: Option<Vec<disks::DiskHarvest>>,
|
||||||
pub io: Option<disks::IoHarvest>,
|
pub io: Option<disks::IoHarvest>,
|
||||||
|
#[cfg(feature = "battery")]
|
||||||
pub list_of_batteries: Option<Vec<batteries::BatteryHarvest>>,
|
pub list_of_batteries: Option<Vec<batteries::BatteryHarvest>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,6 +55,7 @@ impl Default for Data {
|
|||||||
disks: None,
|
disks: None,
|
||||||
io: None,
|
io: None,
|
||||||
network: None,
|
network: None,
|
||||||
|
#[cfg(feature = "battery")]
|
||||||
list_of_batteries: None,
|
list_of_batteries: None,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -95,7 +99,9 @@ pub struct DataCollector {
|
|||||||
total_tx: u64,
|
total_tx: u64,
|
||||||
show_average_cpu: bool,
|
show_average_cpu: bool,
|
||||||
widgets_to_harvest: UsedWidgets,
|
widgets_to_harvest: UsedWidgets,
|
||||||
|
#[cfg(feature = "battery")]
|
||||||
battery_manager: Option<Manager>,
|
battery_manager: Option<Manager>,
|
||||||
|
#[cfg(feature = "battery")]
|
||||||
battery_list: Option<Vec<Battery>>,
|
battery_list: Option<Vec<Battery>>,
|
||||||
filters: DataFilters,
|
filters: DataFilters,
|
||||||
}
|
}
|
||||||
@ -122,7 +128,9 @@ impl DataCollector {
|
|||||||
total_tx: 0,
|
total_tx: 0,
|
||||||
show_average_cpu: false,
|
show_average_cpu: false,
|
||||||
widgets_to_harvest: UsedWidgets::default(),
|
widgets_to_harvest: UsedWidgets::default(),
|
||||||
|
#[cfg(feature = "battery")]
|
||||||
battery_manager: None,
|
battery_manager: None,
|
||||||
|
#[cfg(feature = "battery")]
|
||||||
battery_list: None,
|
battery_list: None,
|
||||||
filters,
|
filters,
|
||||||
}
|
}
|
||||||
@ -150,13 +158,16 @@ impl DataCollector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.widgets_to_harvest.use_battery {
|
#[cfg(feature = "battery")]
|
||||||
if let Ok(battery_manager) = Manager::new() {
|
{
|
||||||
if let Ok(batteries) = battery_manager.batteries() {
|
if self.widgets_to_harvest.use_battery {
|
||||||
let battery_list: Vec<Battery> = batteries.filter_map(Result::ok).collect();
|
if let Ok(battery_manager) = Manager::new() {
|
||||||
if !battery_list.is_empty() {
|
if let Ok(batteries) = battery_manager.batteries() {
|
||||||
self.battery_list = Some(battery_list);
|
let battery_list: Vec<Battery> = batteries.filter_map(Result::ok).collect();
|
||||||
self.battery_manager = Some(battery_manager);
|
if !battery_list.is_empty() {
|
||||||
|
self.battery_list = Some(battery_list);
|
||||||
|
self.battery_manager = Some(battery_manager);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -235,10 +246,13 @@ impl DataCollector {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Batteries
|
// Batteries
|
||||||
if let Some(battery_manager) = &self.battery_manager {
|
#[cfg(feature = "battery")]
|
||||||
if let Some(battery_list) = &mut self.battery_list {
|
{
|
||||||
self.data.list_of_batteries =
|
if let Some(battery_manager) = &self.battery_manager {
|
||||||
Some(batteries::refresh_batteries(battery_manager, battery_list));
|
if let Some(battery_list) = &mut self.battery_list {
|
||||||
|
self.data.list_of_batteries =
|
||||||
|
Some(batteries::refresh_batteries(battery_manager, battery_list));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -945,9 +945,11 @@ impl std::str::FromStr for BottomWidgetType {
|
|||||||
"temp" | "temperature" => Ok(BottomWidgetType::Temp),
|
"temp" | "temperature" => Ok(BottomWidgetType::Temp),
|
||||||
"disk" => Ok(BottomWidgetType::Disk),
|
"disk" => Ok(BottomWidgetType::Disk),
|
||||||
"empty" => Ok(BottomWidgetType::Empty),
|
"empty" => Ok(BottomWidgetType::Empty),
|
||||||
"battery" | "batt" => Ok(BottomWidgetType::Battery),
|
"battery" | "batt" if cfg!(feature = "battery") => Ok(BottomWidgetType::Battery),
|
||||||
_ => Err(BottomError::ConfigError(format!(
|
_ => {
|
||||||
"\"{}\" is an invalid widget name.
|
if cfg!(feature = "battery") {
|
||||||
|
Err(BottomError::ConfigError(format!(
|
||||||
|
"\"{}\" is an invalid widget name.
|
||||||
|
|
||||||
Supported widget names:
|
Supported widget names:
|
||||||
+--------------------------+
|
+--------------------------+
|
||||||
@ -966,8 +968,31 @@ Supported widget names:
|
|||||||
| batt, battery |
|
| batt, battery |
|
||||||
+--------------------------+
|
+--------------------------+
|
||||||
",
|
",
|
||||||
s
|
s
|
||||||
))),
|
)))
|
||||||
|
} else {
|
||||||
|
Err(BottomError::ConfigError(format!(
|
||||||
|
"\"{}\" is an invalid widget name.
|
||||||
|
|
||||||
|
Supported widget names:
|
||||||
|
+--------------------------+
|
||||||
|
| cpu |
|
||||||
|
+--------------------------+
|
||||||
|
| mem, memory |
|
||||||
|
+--------------------------+
|
||||||
|
| net, network |
|
||||||
|
+--------------------------+
|
||||||
|
| proc, process, processes |
|
||||||
|
+--------------------------+
|
||||||
|
| temp, temperature |
|
||||||
|
+--------------------------+
|
||||||
|
| disk |
|
||||||
|
+--------------------------+
|
||||||
|
",
|
||||||
|
s
|
||||||
|
)))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -217,9 +217,12 @@ fn main() -> Result<()> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Battery
|
// Battery
|
||||||
if app.used_widgets.use_battery {
|
#[cfg(feature = "battery")]
|
||||||
app.canvas_data.battery_data =
|
{
|
||||||
convert_battery_harvest(&app.data_collection);
|
if app.used_widgets.use_battery {
|
||||||
|
app.canvas_data.battery_data =
|
||||||
|
convert_battery_harvest(&app.data_collection);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
132
src/clap.rs
132
src/clap.rs
@ -14,6 +14,72 @@ FLAGS:
|
|||||||
const USAGE: &str = "
|
const USAGE: &str = "
|
||||||
btm [FLAG]";
|
btm [FLAG]";
|
||||||
|
|
||||||
|
const DEFAULT_WIDGET_TYPE_STR: &str = if cfg!(feature = "battery") {
|
||||||
|
"\
|
||||||
|
Sets which widget type to use as the default widget.
|
||||||
|
For the default layout, this defaults to the 'process' widget.
|
||||||
|
For a custom layout, it defaults to the first widget it sees.
|
||||||
|
|
||||||
|
For example, suppose we have a layout that looks like:
|
||||||
|
+-------------------+-----------------------+
|
||||||
|
| CPU (1) | CPU (2) |
|
||||||
|
+---------+---------+-------------+---------+
|
||||||
|
| Process | CPU (3) | Temperature | CPU (4) |
|
||||||
|
+---------+---------+-------------+---------+
|
||||||
|
|
||||||
|
Setting '--default_widget_type Temp' will make the Temperature
|
||||||
|
widget selected by default.
|
||||||
|
|
||||||
|
Supported widget names:
|
||||||
|
+--------------------------+
|
||||||
|
| cpu |
|
||||||
|
+--------------------------+
|
||||||
|
| mem, memory |
|
||||||
|
+--------------------------+
|
||||||
|
| net, network |
|
||||||
|
+--------------------------+
|
||||||
|
| proc, process, processes |
|
||||||
|
+--------------------------+
|
||||||
|
| temp, temperature |
|
||||||
|
+--------------------------+
|
||||||
|
| disk |
|
||||||
|
+--------------------------+
|
||||||
|
| batt, battery |
|
||||||
|
+--------------------------+
|
||||||
|
\n\n"
|
||||||
|
} else {
|
||||||
|
"\
|
||||||
|
Sets which widget type to use as the default widget.
|
||||||
|
For the default layout, this defaults to the 'process' widget.
|
||||||
|
For a custom layout, it defaults to the first widget it sees.
|
||||||
|
|
||||||
|
For example, suppose we have a layout that looks like:
|
||||||
|
+-------------------+-----------------------+
|
||||||
|
| CPU (1) | CPU (2) |
|
||||||
|
+---------+---------+-------------+---------+
|
||||||
|
| Process | CPU (3) | Temperature | CPU (4) |
|
||||||
|
+---------+---------+-------------+---------+
|
||||||
|
|
||||||
|
Setting '--default_widget_type Temp' will make the Temperature
|
||||||
|
widget selected by default.
|
||||||
|
|
||||||
|
Supported widget names:
|
||||||
|
+--------------------------+
|
||||||
|
| cpu |
|
||||||
|
+--------------------------+
|
||||||
|
| mem, memory |
|
||||||
|
+--------------------------+
|
||||||
|
| net, network |
|
||||||
|
+--------------------------+
|
||||||
|
| proc, process, processes |
|
||||||
|
+--------------------------+
|
||||||
|
| temp, temperature |
|
||||||
|
+--------------------------+
|
||||||
|
| disk |
|
||||||
|
+--------------------------+
|
||||||
|
\n\n"
|
||||||
|
};
|
||||||
|
|
||||||
pub fn get_matches() -> clap::ArgMatches<'static> {
|
pub fn get_matches() -> clap::ArgMatches<'static> {
|
||||||
build_app().get_matches()
|
build_app().get_matches()
|
||||||
}
|
}
|
||||||
@ -66,14 +132,6 @@ disabled via --hide_time then this will have no effect.\n\n\n",
|
|||||||
Hides graphs and uses a more basic look. Design is largely
|
Hides graphs and uses a more basic look. Design is largely
|
||||||
inspired by htop's.\n\n",
|
inspired by htop's.\n\n",
|
||||||
);
|
);
|
||||||
let battery = Arg::with_name("battery")
|
|
||||||
.long("battery")
|
|
||||||
.help("Shows the battery widget.")
|
|
||||||
.long_help(
|
|
||||||
"\
|
|
||||||
Shows the battery widget in default or basic mode. No effect on
|
|
||||||
custom layouts.\n\n",
|
|
||||||
);
|
|
||||||
let case_sensitive = Arg::with_name("case_sensitive")
|
let case_sensitive = Arg::with_name("case_sensitive")
|
||||||
.short("S")
|
.short("S")
|
||||||
.long("case_sensitive")
|
.long("case_sensitive")
|
||||||
@ -318,40 +376,7 @@ use CPU (3) as the default instead.
|
|||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.value_name("WIDGET TYPE")
|
.value_name("WIDGET TYPE")
|
||||||
.help("Sets the default widget type, use --help for more info.")
|
.help("Sets the default widget type, use --help for more info.")
|
||||||
.long_help(
|
.long_help(DEFAULT_WIDGET_TYPE_STR);
|
||||||
"\
|
|
||||||
Sets which widget type to use as the default widget.
|
|
||||||
For the default layout, this defaults to the 'process' widget.
|
|
||||||
For a custom layout, it defaults to the first widget it sees.
|
|
||||||
|
|
||||||
For example, suppose we have a layout that looks like:
|
|
||||||
+-------------------+-----------------------+
|
|
||||||
| CPU (1) | CPU (2) |
|
|
||||||
+---------+---------+-------------+---------+
|
|
||||||
| Process | CPU (3) | Temperature | CPU (4) |
|
|
||||||
+---------+---------+-------------+---------+
|
|
||||||
|
|
||||||
Setting '--default_widget_type Temp' will make the Temperature
|
|
||||||
widget selected by default.
|
|
||||||
|
|
||||||
Supported widget names:
|
|
||||||
+--------------------------+
|
|
||||||
| cpu |
|
|
||||||
+--------------------------+
|
|
||||||
| mem, memory |
|
|
||||||
+--------------------------+
|
|
||||||
| net, network |
|
|
||||||
+--------------------------+
|
|
||||||
| proc, process, processes |
|
|
||||||
+--------------------------+
|
|
||||||
| temp, temperature |
|
|
||||||
+--------------------------+
|
|
||||||
| disk |
|
|
||||||
+--------------------------+
|
|
||||||
| batt, battery |
|
|
||||||
+--------------------------+
|
|
||||||
\n\n",
|
|
||||||
);
|
|
||||||
let rate = Arg::with_name("rate")
|
let rate = Arg::with_name("rate")
|
||||||
.short("r")
|
.short("r")
|
||||||
.long("rate")
|
.long("rate")
|
||||||
@ -408,7 +433,7 @@ Displays the network widget with a log scale. Defaults to a non-log scale.\n\n"
|
|||||||
Displays the network widget with binary prefixes (i.e. kibibits, mebibits) rather than a decimal prefix (i.e. kilobits, megabits). Defaults to decimal prefixes.\n\n\n",
|
Displays the network widget with binary prefixes (i.e. kibibits, mebibits) rather than a decimal prefix (i.e. kilobits, megabits). Defaults to decimal prefixes.\n\n\n",
|
||||||
);
|
);
|
||||||
|
|
||||||
App::new(crate_name!())
|
let app = App::new(crate_name!())
|
||||||
.setting(AppSettings::UnifiedHelpMessage)
|
.setting(AppSettings::UnifiedHelpMessage)
|
||||||
.version(crate_version!())
|
.version(crate_version!())
|
||||||
.author(crate_authors!())
|
.author(crate_authors!())
|
||||||
@ -423,12 +448,10 @@ Displays the network widget with binary prefixes (i.e. kibibits, mebibits) rathe
|
|||||||
.group(ArgGroup::with_name("TEMPERATURE_TYPE").args(&["kelvin", "fahrenheit", "celsius"]))
|
.group(ArgGroup::with_name("TEMPERATURE_TYPE").args(&["kelvin", "fahrenheit", "celsius"]))
|
||||||
.arg(autohide_time)
|
.arg(autohide_time)
|
||||||
.arg(basic)
|
.arg(basic)
|
||||||
.arg(battery)
|
|
||||||
.arg(case_sensitive)
|
.arg(case_sensitive)
|
||||||
.arg(process_command)
|
.arg(process_command)
|
||||||
.arg(config_location)
|
.arg(config_location)
|
||||||
.arg(color)
|
.arg(color)
|
||||||
// .arg(debug)
|
|
||||||
.arg(mem_as_value)
|
.arg(mem_as_value)
|
||||||
.arg(default_time_value)
|
.arg(default_time_value)
|
||||||
.arg(default_widget_count)
|
.arg(default_widget_count)
|
||||||
@ -442,7 +465,6 @@ Displays the network widget with binary prefixes (i.e. kibibits, mebibits) rathe
|
|||||||
.arg(show_table_scroll_position)
|
.arg(show_table_scroll_position)
|
||||||
.arg(left_legend)
|
.arg(left_legend)
|
||||||
.arg(disable_advanced_kill)
|
.arg(disable_advanced_kill)
|
||||||
// .arg(no_write)
|
|
||||||
.arg(rate)
|
.arg(rate)
|
||||||
.arg(regex)
|
.arg(regex)
|
||||||
.arg(time_delta)
|
.arg(time_delta)
|
||||||
@ -452,5 +474,21 @@ Displays the network widget with binary prefixes (i.e. kibibits, mebibits) rathe
|
|||||||
.arg(network_use_binary_prefix)
|
.arg(network_use_binary_prefix)
|
||||||
.arg(current_usage)
|
.arg(current_usage)
|
||||||
.arg(use_old_network_legend)
|
.arg(use_old_network_legend)
|
||||||
.arg(whole_word)
|
.arg(whole_word);
|
||||||
|
|
||||||
|
let app = if cfg!(feature = "battery") {
|
||||||
|
let battery = Arg::with_name("battery")
|
||||||
|
.long("battery")
|
||||||
|
.help("Shows the battery widget.")
|
||||||
|
.long_help(
|
||||||
|
"\
|
||||||
|
Shows the battery widget in default or basic mode. No effect on
|
||||||
|
custom layouts.\n\n",
|
||||||
|
);
|
||||||
|
app.arg(battery)
|
||||||
|
} else {
|
||||||
|
app
|
||||||
|
};
|
||||||
|
|
||||||
|
app
|
||||||
}
|
}
|
||||||
|
@ -1362,6 +1362,7 @@ pub fn group_process_data(
|
|||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "battery")]
|
||||||
pub fn convert_battery_harvest(
|
pub fn convert_battery_harvest(
|
||||||
current_data: &data_farmer::DataCollection,
|
current_data: &data_farmer::DataCollection,
|
||||||
) -> Vec<ConvertedBatteryData> {
|
) -> Vec<ConvertedBatteryData> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user