1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 19:47:45 +00:00

Merge branch 'main' into tail_notify

This commit is contained in:
Jan Scheer 2022-05-19 23:00:31 +02:00
commit a62f71f93e
No known key found for this signature in database
GPG key ID: C62AD4C29E2B9828
2 changed files with 35 additions and 20 deletions

View file

@ -265,6 +265,7 @@ pub fn uu_app<'a>() -> Command<'a> {
.short('d') .short('d')
.long(OPT_DATE) .long(OPT_DATE)
.takes_value(true) .takes_value(true)
.value_name("STRING")
.help("display time described by STRING, not 'now'"), .help("display time described by STRING, not 'now'"),
) )
.arg( .arg(
@ -272,6 +273,7 @@ pub fn uu_app<'a>() -> Command<'a> {
.short('f') .short('f')
.long(OPT_FILE) .long(OPT_FILE)
.takes_value(true) .takes_value(true)
.value_name("DATEFILE")
.value_hint(clap::ValueHint::FilePath) .value_hint(clap::ValueHint::FilePath)
.help("like --date; once for each line of DATEFILE"), .help("like --date; once for each line of DATEFILE"),
) )
@ -280,6 +282,7 @@ pub fn uu_app<'a>() -> Command<'a> {
.short('I') .short('I')
.long(OPT_ISO_8601) .long(OPT_ISO_8601)
.takes_value(true) .takes_value(true)
.value_name("FMT")
.help(ISO_8601_HELP_STRING), .help(ISO_8601_HELP_STRING),
) )
.arg( .arg(
@ -292,6 +295,7 @@ pub fn uu_app<'a>() -> Command<'a> {
Arg::new(OPT_RFC_3339) Arg::new(OPT_RFC_3339)
.long(OPT_RFC_3339) .long(OPT_RFC_3339)
.takes_value(true) .takes_value(true)
.value_name("FMT")
.help(RFC_3339_HELP_STRING), .help(RFC_3339_HELP_STRING),
) )
.arg( .arg(
@ -304,6 +308,7 @@ pub fn uu_app<'a>() -> Command<'a> {
.short('r') .short('r')
.long(OPT_REFERENCE) .long(OPT_REFERENCE)
.takes_value(true) .takes_value(true)
.value_name("FILE")
.value_hint(clap::ValueHint::AnyPath) .value_hint(clap::ValueHint::AnyPath)
.help("display the last modification time of FILE"), .help("display the last modification time of FILE"),
) )
@ -312,6 +317,7 @@ pub fn uu_app<'a>() -> Command<'a> {
.short('s') .short('s')
.long(OPT_SET) .long(OPT_SET)
.takes_value(true) .takes_value(true)
.value_name("STRING")
.help(OPT_SET_HELP_STRING), .help(OPT_SET_HELP_STRING),
) )
.arg( .arg(

View file

@ -90,34 +90,41 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
output.push_str(&uname.nodename()); output.push_str(&uname.nodename());
output.push(' '); output.push(' ');
} }
if kernelrelease || all { if kernelrelease || all {
output.push_str(&uname.release()); output.push_str(&uname.release());
output.push(' '); output.push(' ');
} }
if kernelversion || all { if kernelversion || all {
output.push_str(&uname.version()); output.push_str(&uname.version());
output.push(' '); output.push(' ');
} }
if machine || all { if machine || all {
output.push_str(&uname.machine()); output.push_str(&uname.machine());
output.push(' '); output.push(' ');
} }
if processor || all {
// According to https://stackoverflow.com/posts/394271/revisions
// Most of the time, it returns unknown
output.push_str("unknown");
output.push(' ');
}
if hwplatform || all {
// According to https://lists.gnu.org/archive/html/bug-coreutils/2005-09/msg00063.html
// Most of the time, it returns unknown
output.push_str("unknown");
output.push(' ');
}
if os || all { if os || all {
output.push_str(HOST_OS); output.push_str(HOST_OS);
output.push(' '); output.push(' ');
} }
// This option is unsupported on modern Linux systems
// See: https://lists.gnu.org/archive/html/bug-coreutils/2005-09/msg00063.html
if processor {
output.push_str("unknown");
output.push(' ');
}
// This option is unsupported on modern Linux systems
// See: https://lists.gnu.org/archive/html/bug-coreutils/2005-09/msg00063.html
if hwplatform {
output.push_str("unknown");
output.push(' ');
}
println!("{}", output.trim_end()); println!("{}", output.trim_end());
Ok(()) Ok(())
@ -151,20 +158,22 @@ pub fn uu_app<'a>() -> Command<'a> {
.short('v') .short('v')
.long(options::KERNELVERSION) .long(options::KERNELVERSION)
.help("print the operating system version.")) .help("print the operating system version."))
.arg(Arg::new(options::HWPLATFORM)
.short('i')
.long(options::HWPLATFORM)
.help("print the hardware platform (non-portable)"))
.arg(Arg::new(options::MACHINE) .arg(Arg::new(options::MACHINE)
.short('m') .short('m')
.long(options::MACHINE) .long(options::MACHINE)
.help("print the machine hardware name.")) .help("print the machine hardware name."))
.arg(Arg::new(options::PROCESSOR)
.short('p')
.long(options::PROCESSOR)
.help("print the processor type (non-portable)"))
.arg(Arg::new(options::OS) .arg(Arg::new(options::OS)
.short('o') .short('o')
.long(options::OS) .long(options::OS)
.help("print the operating system name.")) .help("print the operating system name."))
.arg(Arg::new(options::PROCESSOR)
.short('p')
.long(options::PROCESSOR)
.help("print the processor type (non-portable)")
.hide(true))
.arg(Arg::new(options::HWPLATFORM)
.short('i')
.long(options::HWPLATFORM)
.help("print the hardware platform (non-portable)")
.hide(true))
} }