mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
yes: allow --version
Test: tests/help/help-version-getopt.sh
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
|
||||
// cSpell:ignore strs
|
||||
|
||||
use clap::{builder::ValueParser, Arg, ArgAction, Command};
|
||||
use clap::{builder::ValueParser, crate_version, Arg, ArgAction, Command};
|
||||
use std::error::Error;
|
||||
use std::ffi::OsString;
|
||||
use std::io::{self, Write};
|
||||
@@ -44,6 +44,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
||||
|
||||
pub fn uu_app() -> Command {
|
||||
Command::new(uucore::util_name())
|
||||
.version(crate_version!())
|
||||
.about(ABOUT)
|
||||
.override_usage(format_usage(USAGE))
|
||||
.arg(
|
||||
|
||||
@@ -35,6 +35,11 @@ fn test_invalid_arg() {
|
||||
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_version() {
|
||||
new_ucmd!().arg("--version").succeeds();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_simple() {
|
||||
run(NO_ARGS, b"y\ny\ny\ny\n");
|
||||
|
||||
Reference in New Issue
Block a user