Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

touch: rename CURRENT to TIMESTAMP #4989

Merged
merged 2 commits into from
Jun 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions src/uu/touch/src/touch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// For the full copyright and license information, please view the LICENSE file
// that was distributed with this source code.

// spell-checker:ignore (ToDO) filetime strptime utcoff strs datetime MMDDhhmm clapv PWSTR lpszfilepath hresult mktime YYYYMMDDHHMM YYMMDDHHMM DATETIME YYYYMMDDHHMMS subsecond humantime
// spell-checker:ignore (ToDO) filetime datetime MMDDhhmm lpszfilepath mktime YYYYMMDDHHMM YYMMDDHHMM DATETIME YYYYMMDDHHMMS subsecond humantime

use clap::builder::ValueParser;
use clap::{crate_version, Arg, ArgAction, ArgGroup, Command};
Expand All @@ -29,7 +29,7 @@ pub mod options {
pub mod sources {
pub static DATE: &str = "date";
pub static REFERENCE: &str = "reference";
pub static CURRENT: &str = "current";
pub static TIMESTAMP: &str = "timestamp";
}
pub static HELP: &str = "help";
pub static ACCESS: &str = "access";
Expand Down Expand Up @@ -120,12 +120,12 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
(timestamp, timestamp)
}
(None, None) => {
let timestamp =
if let Some(current) = matches.get_one::<String>(options::sources::CURRENT) {
parse_timestamp(current)?
} else {
local_dt_to_filetime(time::OffsetDateTime::now_local().unwrap())
};
let timestamp = if let Some(ts) = matches.get_one::<String>(options::sources::TIMESTAMP)
{
parse_timestamp(ts)?
} else {
local_dt_to_filetime(time::OffsetDateTime::now_local().unwrap())
};
(timestamp, timestamp)
}
};
Expand Down Expand Up @@ -243,7 +243,7 @@ pub fn uu_app() -> Command {
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::sources::CURRENT)
Arg::new(options::sources::TIMESTAMP)
.short('t')
.help("use [[CC]YY]MMDDhhmm[.ss] instead of the current time")
.value_name("STAMP"),
Expand All @@ -255,7 +255,7 @@ pub fn uu_app() -> Command {
.allow_hyphen_values(true)
.help("parse argument and use it instead of current time")
.value_name("STRING")
.conflicts_with(options::sources::CURRENT),
.conflicts_with(options::sources::TIMESTAMP),
)
.arg(
Arg::new(options::MODIFICATION)
Expand Down Expand Up @@ -288,7 +288,7 @@ pub fn uu_app() -> Command {
.value_name("FILE")
.value_parser(ValueParser::os_string())
.value_hint(clap::ValueHint::AnyPath)
.conflicts_with(options::sources::CURRENT),
.conflicts_with(options::sources::TIMESTAMP),
)
.arg(
Arg::new(options::TIME)
Expand All @@ -311,7 +311,7 @@ pub fn uu_app() -> Command {
.group(
ArgGroup::new(options::SOURCES)
.args([
options::sources::CURRENT,
options::sources::TIMESTAMP,
options::sources::DATE,
options::sources::REFERENCE,
])
Expand Down