From 8cd9f9d89f7d912d98122a1dfab4792e41d7c938 Mon Sep 17 00:00:00 2001 From: Fuad Ismail <fuad1502@gmail.com> Date: Wed, 11 Dec 2024 10:42:07 +0700 Subject: [PATCH] dmesg: add since/until options. --- src/uu/dmesg/src/dmesg.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/uu/dmesg/src/dmesg.rs b/src/uu/dmesg/src/dmesg.rs index 32dfad8..b15afff 100644 --- a/src/uu/dmesg/src/dmesg.rs +++ b/src/uu/dmesg/src/dmesg.rs @@ -105,6 +105,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { } dmesg.level_filters = Some(level_filters); } + if let Some(_since) = matches.get_one::<String>(options::SINCE) {} + if let Some(_until) = matches.get_one::<String>(options::UNTIL) {} dmesg.print()?; Ok(()) } @@ -151,6 +153,18 @@ pub fn uu_app() -> Command { .help("restrict output to defined levels") .action(ArgAction::Append), ) + .arg( + Arg::new(options::SINCE) + .long("since") + .help("display the lines since the specified time") + .action(ArgAction::Set), + ) + .arg( + Arg::new(options::UNTIL) + .long("until") + .help("display the lines until the specified time") + .action(ArgAction::Set), + ) } mod options { @@ -159,6 +173,8 @@ mod options { pub const TIME_FORMAT: &str = "time-format"; pub const FACILITY: &str = "facility"; pub const LEVEL: &str = "level"; + pub const SINCE: &str = "since"; + pub const UNTIL: &str = "until"; } struct Dmesg<'a> {