diff --git a/Cargo.lock b/Cargo.lock index 997cd5d0b..f40f1c094 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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", diff --git a/src/uu/uptime/Cargo.toml b/src/uu/uptime/Cargo.toml index 8b0ff0e79..960db95f7 100644 --- a/src/uu/uptime/Cargo.toml +++ b/src/uu/uptime/Cargo.toml @@ -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" } diff --git a/src/uu/uptime/src/uptime.rs b/src/uu/uptime/src/uptime.rs index 5c51a535b..f53a15885 100644 --- a/src/uu/uptime/src/uptime.rs +++ b/src/uu/uptime/src/uptime.rs @@ -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); diff --git a/tests/by-util/test_uptime.rs b/tests/by-util/test_uptime.rs index b890ff807..c8f6a11d3 100644 --- a/tests/by-util/test_uptime.rs +++ b/tests/by-util/test_uptime.rs @@ -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(); +}