mirror of
https://github.com/uutils/coreutils.git
synced 2025-07-07 21:45:01 +00:00
touch: add -f flag (#8274)
Some checks are pending
CICD / Style/cargo-deny (push) Waiting to run
CICD / Build (push) Blocked by required conditions
CICD / Style/deps (push) Waiting to run
CICD / Documentation/warnings (push) Waiting to run
CICD / MinRustV (push) Waiting to run
CICD / Test all features separately (push) Blocked by required conditions
CICD / Dependencies (push) Waiting to run
CICD / Build/Makefile (push) Blocked by required conditions
CICD / Build/stable (push) Blocked by required conditions
CICD / Build/nightly (push) Blocked by required conditions
CICD / Binary sizes (push) Blocked by required conditions
CICD / Tests/BusyBox test suite (push) Blocked by required conditions
CICD / Tests/Toybox test suite (push) Blocked by required conditions
CICD / Code Coverage (push) Waiting to run
CICD / Separate Builds (push) Waiting to run
CICD / Build/SELinux (push) Blocked by required conditions
GnuTests / Run GNU tests (push) Waiting to run
Android / Test builds (push) Waiting to run
Code Quality / Style/format (push) Waiting to run
Code Quality / Style/lint (push) Waiting to run
Code Quality / Style/spelling (push) Waiting to run
Code Quality / Style/toml (push) Waiting to run
Code Quality / Style/Python (push) Waiting to run
Code Quality / Pre-commit hooks (push) Waiting to run
FreeBSD / Style and Lint (push) Waiting to run
FreeBSD / Tests (push) Waiting to run
Some checks are pending
CICD / Style/cargo-deny (push) Waiting to run
CICD / Build (push) Blocked by required conditions
CICD / Style/deps (push) Waiting to run
CICD / Documentation/warnings (push) Waiting to run
CICD / MinRustV (push) Waiting to run
CICD / Test all features separately (push) Blocked by required conditions
CICD / Dependencies (push) Waiting to run
CICD / Build/Makefile (push) Blocked by required conditions
CICD / Build/stable (push) Blocked by required conditions
CICD / Build/nightly (push) Blocked by required conditions
CICD / Binary sizes (push) Blocked by required conditions
CICD / Tests/BusyBox test suite (push) Blocked by required conditions
CICD / Tests/Toybox test suite (push) Blocked by required conditions
CICD / Code Coverage (push) Waiting to run
CICD / Separate Builds (push) Waiting to run
CICD / Build/SELinux (push) Blocked by required conditions
GnuTests / Run GNU tests (push) Waiting to run
Android / Test builds (push) Waiting to run
Code Quality / Style/format (push) Waiting to run
Code Quality / Style/lint (push) Waiting to run
Code Quality / Style/spelling (push) Waiting to run
Code Quality / Style/toml (push) Waiting to run
Code Quality / Style/Python (push) Waiting to run
Code Quality / Pre-commit hooks (push) Waiting to run
FreeBSD / Style and Lint (push) Waiting to run
FreeBSD / Tests (push) Waiting to run
* touch: fix f flag * Update src/uu/touch/src/touch.rs Co-authored-by: Sylvestre Ledru <sylvestre@debian.org> * touch: add test for f flag * Update src/uu/touch/src/touch.rs Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com> * Update tests/by-util/test_touch.rs Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com> * remove unnecessary comment --------- Co-authored-by: Sylvestre Ledru <sylvestre@debian.org> Co-authored-by: Daniel Hofstetter <daniel.hofstetter@42dh.com>
This commit is contained in:
parent
1d76a00840
commit
c64adee068
2 changed files with 19 additions and 0 deletions
|
@ -99,6 +99,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";
|
||||
|
@ -291,6 +292,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')
|
||||
|
|
|
@ -1006,3 +1006,14 @@ 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));
|
||||
at.remove(file);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue