17 lines
467 B
Rust
17 lines
467 B
Rust
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)
|
|
}
|
|
}
|