v1 implemented
it compiles
This commit is contained in:
16
src/config.rs
Normal file
16
src/config.rs
Normal file
@@ -0,0 +1,16 @@
|
||||
use clap::Parser;
|
||||
use std::time::Duration;
|
||||
|
||||
#[derive(Debug, Clone, Parser)]
|
||||
#[command(name = "sloptop", about = "A lightweight TUI resource monitor")]
|
||||
pub struct Config {
|
||||
/// Polling interval in milliseconds
|
||||
#[arg(short, long, default_value_t = 1000, value_parser = clap::value_parser!(u64).range(200..=5000))]
|
||||
pub interval_ms: u64,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
pub fn refresh_interval(&self) -> Duration {
|
||||
Duration::from_millis(self.interval_ms)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user