Merge pull request #1624 from sylvestre/uptime-refresh

refactor(uptime): some minor improvements
This commit is contained in:
Sylvestre Ledru
2020-11-20 10:02:13 +01:00
committed by GitHub
4 changed files with 9 additions and 5 deletions
Generated
-1
View File
@@ -2258,7 +2258,6 @@ version = "0.0.1"
dependencies = [
"chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)",
"clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)",
"getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)",
"time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)",
"uucore 0.0.4",
"uucore_procs 0.0.4",
+1 -2
View File
@@ -15,10 +15,9 @@ edition = "2018"
path = "src/uptime.rs"
[dependencies]
getopts = "0.2.18"
time = "0.1.40"
chrono = "0.4"
clap = "2.32"
clap = "2.33"
uucore = { version=">=0.0.4", package="uucore", path="../../uucore", features=["libc", "utmpx"] }
uucore_procs = { version=">=0.0.4", package="uucore_procs", path="../../uucore_procs" }
+2 -2
View File
@@ -27,7 +27,7 @@ static VERSION: &str = env!("CARGO_PKG_VERSION");
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.";
static OPT_SINCE: &str = "SINCE";
static OPT_SINCE: &str = "since";
#[cfg(unix)]
use uucore::libc::getloadavg;
@@ -50,7 +50,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
.arg(
Arg::with_name(OPT_SINCE)
.short("s")
.long("since")
.long(OPT_SINCE)
.help("system up since"),
)
.get_matches_from(args);
+6
View File
@@ -28,3 +28,9 @@ fn test_uptime_since() {
let re = Regex::new(r"\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}").unwrap();
assert!(re.is_match(&result.stdout.trim()));
}
#[test]
fn test_failed() {
let (_at, mut ucmd) = at_and_ucmd!();
ucmd.arg("willfail").fails();
}