summaryrefslogtreecommitdiffstats
path: root/src/clap.rs
diff options
context:
space:
mode:
authorClement Tsang <34804052+ClementTsang@users.noreply.github.com>2021-04-04 05:38:57 -0400
committerGitHub <noreply@github.com>2021-04-04 05:38:57 -0400
commiteb6a737d3430920061cd5e54bf4dc40da21f1fc5 (patch)
treeb329c4b729f31de80405b3a2d015c1525d80d618 /src/clap.rs
parent40f4c796f8d1832e7ef9db7c87db558a1ce12b62 (diff)
feature: Rework network y-axis, linear interpolation for off-screen data (#437)
Rewrite of the y-axis labeling and scaling for the network widget, along with more customization. This still has one step to be optimized (cache results so we don't have to recalculate the legend each time), but will be done in another PR for sake of this one being too large already. Furthermore, this change adds linear interpolation at the 0 point in the case a data point shoots too far back - this seems to have lead to ugly gaps to the left of graphs in some cases, because the left hand limit was not big enough for the data point. We address this by grabbing values just outside the time range and linearly interpolating at the leftmost limit. This affects all graph widgets (CPU, mem, network). This can be optimized, and will hopefully be prior to release in a separate change.
Diffstat (limited to 'src/clap.rs')
-rw-r--r--src/clap.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/clap.rs b/src/clap.rs
index de1b5448..98ec58ef 100644
--- a/src/clap.rs
+++ b/src/clap.rs
@@ -18,6 +18,7 @@ pub fn get_matches() -> clap::ArgMatches<'static> {
build_app().get_matches()
}
+// TODO: Refactor this a bit, it's quite messy atm
pub fn build_app() -> App<'static, 'static> {
// Temps
let kelvin = Arg::with_name("kelvin")
@@ -383,6 +384,30 @@ The minimum is 1s (1000), and defaults to 15s (15000).\n\n\n",
Defaults to showing the process widget in tree mode.\n\n",
);
+ let network_use_bytes = Arg::with_name("network_use_bytes")
+ .long("network_use_bytes")
+ .help("Displays the network widget using bytes.")
+ .long_help(
+ "\
+Displays the network widget using bytes. Defaults to bits.\n\n",
+ );
+
+ let network_use_log = Arg::with_name("network_use_log")
+ .long("network_use_log")
+ .help("Displays the network widget with a log scale.")
+ .long_help(
+ "\
+Displays the network widget with a log scale. Defaults to a non-log scale.\n\n",
+ );
+
+ let network_use_binary_prefix = Arg::with_name("network_use_binary_prefix")
+ .long("network_use_binary_prefix")
+ .help("Displays the network widget with binary prefixes.")
+ .long_help(
+ "\
+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!())
.setting(AppSettings::UnifiedHelpMessage)
.version(crate_version!())
@@ -422,6 +447,9 @@ Defaults to showing the process widget in tree mode.\n\n",
.arg(regex)
.arg(time_delta)
.arg(tree)
+ .arg(network_use_bytes)
+ .arg(network_use_log)
+ .arg(network_use_binary_prefix)
.arg(current_usage)
.arg(use_old_network_legend)
.arg(whole_word)