From 395c634c0c037fdcb5a139fd7241ddad6dc8a039 Mon Sep 17 00:00:00 2001 From: Fuad Ismail Date: Sun, 17 Nov 2024 00:09:55 +0700 Subject: [PATCH] dmesg: add about and usage to command. --- src/uu/dmesg/dmesg.md | 7 +++++++ src/uu/dmesg/src/dmesg.rs | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 src/uu/dmesg/dmesg.md diff --git a/src/uu/dmesg/dmesg.md b/src/uu/dmesg/dmesg.md new file mode 100644 index 0000000..25b1522 --- /dev/null +++ b/src/uu/dmesg/dmesg.md @@ -0,0 +1,7 @@ +# dmesg + +``` +dmesg [options] +``` + +Display or control the kernel ring buffer. diff --git a/src/uu/dmesg/src/dmesg.rs b/src/uu/dmesg/src/dmesg.rs index 27ba0ef..4f1a9c3 100644 --- a/src/uu/dmesg/src/dmesg.rs +++ b/src/uu/dmesg/src/dmesg.rs @@ -6,10 +6,13 @@ use clap::{crate_version, Arg, ArgAction, Command}; use regex::Regex; use std::fs; -use uucore::error::UResult; +use uucore::{error::UResult, format_usage, help_about, help_usage}; mod json; +const ABOUT: &str = help_about!("dmesg.md"); +const USAGE: &str = help_usage!("dmesg.md"); + #[uucore::main] pub fn uumain(args: impl uucore::Args) -> UResult<()> { let mut dmesg = Dmesg::new(); @@ -26,6 +29,8 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> { pub fn uu_app() -> Command { Command::new(uucore::util_name()) + .override_usage(format_usage(USAGE)) + .about(ABOUT) .version(crate_version!()) .arg( Arg::new(options::KMSG_FILE)