From 66fef28ec66dd74a42b576e1088fb29e4ff57879 Mon Sep 17 00:00:00 2001 From: Miles Liu Date: Thu, 16 Mar 2023 17:48:55 +0800 Subject: [PATCH 1/2] uptime: move help strings to markdown file --- src/uu/uptime/src/uptime.rs | 8 +++----- src/uu/uptime/uptime.md | 9 +++++++++ 2 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 src/uu/uptime/uptime.md diff --git a/src/uu/uptime/src/uptime.rs b/src/uu/uptime/src/uptime.rs index 3a561f419..7d54263eb 100644 --- a/src/uu/uptime/src/uptime.rs +++ b/src/uu/uptime/src/uptime.rs @@ -11,17 +11,15 @@ use chrono::{Local, TimeZone, Utc}; use clap::{crate_version, Arg, ArgAction, Command}; -use uucore::format_usage; +use uucore::{format_usage, help_about, help_usage}; // import crate time from utmpx pub use uucore::libc; use uucore::libc::time_t; use uucore::error::{UResult, USimpleError}; -static ABOUT: &str = "Display the current time, the length of time the system has been up,\n\ - the number of users on the system, and the average number of jobs\n\ - in the run queue over the last 1, 5 and 15 minutes."; -const USAGE: &str = "{} [OPTION]..."; +const ABOUT: &str = help_about!("uptime.md"); +const USAGE: &str = help_usage!("uptime.md"); pub mod options { pub static SINCE: &str = "since"; } diff --git a/src/uu/uptime/uptime.md b/src/uu/uptime/uptime.md new file mode 100644 index 000000000..fd9c8fd2f --- /dev/null +++ b/src/uu/uptime/uptime.md @@ -0,0 +1,9 @@ +# uptime + +``` +uptime [OPTION]... +``` + +Display the current time, the length of time the system has been up, +the number of users on the system, and the average number of jobs +in the run queue over the last 1, 5 and 15 minutes. From 6956377405cbc063a7b6c9bd324e7660d3bfdf57 Mon Sep 17 00:00:00 2001 From: Miles Liu Date: Thu, 16 Mar 2023 19:44:27 +0800 Subject: [PATCH 2/2] uptime: remove unused import --- src/uu/uptime/src/uptime.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/uu/uptime/src/uptime.rs b/src/uu/uptime/src/uptime.rs index 7d54263eb..6f4e62084 100644 --- a/src/uu/uptime/src/uptime.rs +++ b/src/uu/uptime/src/uptime.rs @@ -11,10 +11,8 @@ use chrono::{Local, TimeZone, Utc}; use clap::{crate_version, Arg, ArgAction, Command}; -use uucore::{format_usage, help_about, help_usage}; -// import crate time from utmpx -pub use uucore::libc; use uucore::libc::time_t; +use uucore::{format_usage, help_about, help_usage}; use uucore::error::{UResult, USimpleError};