diff options
author | ClementTsang <clementjhtsang@gmail.com> | 2019-09-25 12:42:39 -0400 |
---|---|---|
committer | ClementTsang <clementjhtsang@gmail.com> | 2019-09-25 12:42:39 -0400 |
commit | 674de1a2d4362ac053601c6bd40c8e3582d8d255 (patch) | |
tree | 20d7e15924e83ae5f6ad73b203a90d08c268d82a | |
parent | b5cacb3e2ed993310d9ebd178041e89f5d4fd754 (diff) |
Added const to make rate switching in the future easier.0.1.0-alpha-3
-rw-r--r-- | TODO.md | 16 | ||||
-rw-r--r-- | src/constants.rs | 1 | ||||
-rw-r--r-- | src/main.rs | 10 |
3 files changed, 11 insertions, 16 deletions
@@ -22,9 +22,7 @@ Note this will probably migrate to GitHub's native Issues; this was mostly for p ## After making public -- Consider bumping up the refresh rate to 3000? - -- Arrow keys for lists. This is a priority! +- Scrolling support for temp/disk - Travis @@ -46,18 +44,8 @@ Note this will probably migrate to GitHub's native Issues; this was mostly for p - Remove any `unwrap()`, ensure no crashing! Might have to use this: <https://doc.rust-lang.org/std/panic/fn.catch_unwind.html> -- Scrolling event in lists - -- Switching between panels - - Truncate columns if needed for tables -- Test for Windows support, mac support, other. May be doable, depends on sysinfo and how much I know about other OSes probably. - -- Seems like the braille symbols are borked on windows. - -- Issue with typing after windows version runs! - - Efficiency!!! - Filtering in processes (that is, allow searching) @@ -66,6 +54,4 @@ Note this will probably migrate to GitHub's native Issues; this was mostly for p - Modularity -- ~~Potentially process managing? Depends on the libraries...~~ Done on Linux! - - Probably good to add a "are you sure" to dd-ing... diff --git a/src/constants.rs b/src/constants.rs index e6c6d17a..af794b47 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -1,3 +1,4 @@ // TODO: Store like three minutes of data, then change how much is shown based on scaling! pub const STALE_MAX_MILLISECONDS : u64 = 60 * 1000; // We wish to store at most 60 seconds worth of data. This may change in the future, or be configurable. pub const TICK_RATE_IN_MILLISECONDS : u64 = 200; // We use this as it's a good value to work with. +pub const DEFAULT_REFRESH_RATE_IN_MILLISECONDS : u128 = 1000; diff --git a/src/main.rs b/src/main.rs index 6872498f..2542b106 100644 --- a/src/main.rs +++ b/src/main.rs @@ -56,7 +56,15 @@ fn main() -> error::Result<()> { //.after_help("Themes:") // TODO: This and others disabled for now .get_matches(); - let update_rate_in_milliseconds : u128 = matches.value_of("RATE_MILLIS").unwrap_or("1000").parse::<u128>()?; + let update_rate_in_milliseconds : u128 = if matches.is_present("RATE_MILLIS") { + matches + .value_of("RATE_MILLIS") + .unwrap_or(&constants::DEFAULT_REFRESH_RATE_IN_MILLISECONDS.to_string()) + .parse::<u128>()? + } + else { + constants::DEFAULT_REFRESH_RATE_IN_MILLISECONDS + }; if update_rate_in_milliseconds < 250 { return Err(RustopError::InvalidArg { |