Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
8 changes: 8 additions & 0 deletions src/uu/touch/src/touch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ pub mod options {
pub static NO_CREATE: &str = "no-create";
pub static NO_DEREF: &str = "no-dereference";
pub static TIME: &str = "time";
pub static FORCE: &str = "force";
}

static ARG_FILES: &str = "files";
Expand Down Expand Up @@ -287,6 +288,13 @@ pub fn uu_app() -> Command {
.value_name("STRING")
.conflicts_with(options::sources::TIMESTAMP),
)
.arg(
Arg::new(options::FORCE)
.short('f')
.help("(ignored)")
.hide(true)
.action(ArgAction::SetTrue),
)
.arg(
Arg::new(options::MODIFICATION)
.short('m')
Expand Down
12 changes: 12 additions & 0 deletions tests/by-util/test_touch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1006,3 +1006,15 @@ fn test_obsolete_posix_format_with_year() {
assert!(at.file_exists("11111111"));
assert!(!at.file_exists("0101000090"));
}

#[test]
fn test_touch_f_option() {
let (at, mut ucmd) = at_and_ucmd!();
let file = "test_f_option.txt";

ucmd.args(&["-f", file]).succeeds().no_output();

assert!(at.file_exists(file));
// Clean up
at.remove(file);
}
Loading