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

touch: constant for the sources ArgGroup

This commit is contained in:
Terts Diepraam 2021-03-13 13:52:08 +01:00
parent ed2787a6df
commit 44c390c290

View file

@ -22,6 +22,8 @@ use std::path::Path;
static VERSION: &str = env!("CARGO_PKG_VERSION"); static VERSION: &str = env!("CARGO_PKG_VERSION");
static ABOUT: &str = "Update the access and modification times of each FILE to the current time."; static ABOUT: &str = "Update the access and modification times of each FILE to the current time.";
pub mod options { pub mod options {
// Both SOURCES and sources are needed as we need to be able to refer to the ArgGroup.
pub static SOURCES: &str = "sources";
pub mod sources { pub mod sources {
pub static DATE: &str = "date"; pub static DATE: &str = "date";
pub static REFERENCE: &str = "reference"; pub static REFERENCE: &str = "reference";
@ -121,7 +123,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
.takes_value(true) .takes_value(true)
.min_values(1), .min_values(1),
) )
.group(ArgGroup::with_name("sources").args(&[ .group(ArgGroup::with_name(options::SOURCES).args(&[
options::sources::CURRENT, options::sources::CURRENT,
options::sources::DATE, options::sources::DATE,
options::sources::REFERENCE, options::sources::REFERENCE,
@ -172,7 +174,7 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
}; };
// Minor optimization: if no reference time was specified, we're done. // Minor optimization: if no reference time was specified, we're done.
if !matches.is_present("sources") { if !matches.is_present(options::SOURCES) {
continue; continue;
} }
} }