cp: move after help to md file

This commit is contained in:
John Shin 2023-04-30 20:02:53 -07:00
parent 78412c5a61
commit 2f975e913e
2 changed files with 23 additions and 3 deletions

View file

@ -7,3 +7,19 @@ cp [OPTION]... -t DIRECTORY SOURCE...
``` ```
Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY. Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.
## After Help
Do not copy a non-directory that has an existing destination with the same or newer modification timestamp;
instead, silently skip the file without failing. If timestamps are being preserved, the comparison is to the
source timestamp truncated to the resolutions of the destination file system and of the system calls used to
update timestamps; this avoids duplicate work if several cp -pu commands are executed with the same source
and destination. This option is ignored if the -n or --no-clobber option is also specified. Also, if
--preserve=links is also specified (like with cp -au for example), that will take precedence; consequently,
depending on the order that files are processed from the source, newer files in the destination may be replaced,
to mirror hard links in the source. which gives more control over which existing files in the destination are
replaced, and its value can be one of the following:
all This is the default operation when an --update option is not specified, and results in all existing files in the destination being replaced.
none This is similar to the --no-clobber option, in that no files in the destination are replaced, but also skipping a file does not induce a failure.
older This is the default operation when --update is specified, and results in files being replaced if theyre older than the corresponding source file.

View file

@ -41,7 +41,9 @@ use uucore::fs::{
canonicalize, paths_refer_to_same_file, FileInformation, MissingHandling, ResolveMode, canonicalize, paths_refer_to_same_file, FileInformation, MissingHandling, ResolveMode,
}; };
use uucore::update_control::{self, UpdateMode}; use uucore::update_control::{self, UpdateMode};
use uucore::{crash, format_usage, help_about, help_usage, prompt_yes, show_error, show_warning}; use uucore::{
crash, format_usage, help_about, help_section, help_usage, prompt_yes, show_error, show_warning,
};
use crate::copydir::copy_directory; use crate::copydir::copy_directory;
@ -232,6 +234,7 @@ pub struct Options {
const ABOUT: &str = help_about!("cp.md"); const ABOUT: &str = help_about!("cp.md");
const USAGE: &str = help_usage!("cp.md"); const USAGE: &str = help_usage!("cp.md");
const AFTER_HELP: &str = help_section!("after help", "cp.md");
static EXIT_ERR: i32 = 1; static EXIT_ERR: i32 = 1;
@ -310,9 +313,8 @@ pub fn uu_app() -> Command {
.version(crate_version!()) .version(crate_version!())
.about(ABOUT) .about(ABOUT)
.override_usage(format_usage(USAGE)) .override_usage(format_usage(USAGE))
.after_help(AFTER_HELP)
.infer_long_args(true) .infer_long_args(true)
.arg(update_control::arguments::update())
.arg(update_control::arguments::update_no_args())
.arg( .arg(
Arg::new(options::TARGET_DIRECTORY) Arg::new(options::TARGET_DIRECTORY)
.short('t') .short('t')
@ -410,6 +412,8 @@ pub fn uu_app() -> Command {
.arg(backup_control::arguments::backup()) .arg(backup_control::arguments::backup())
.arg(backup_control::arguments::backup_no_args()) .arg(backup_control::arguments::backup_no_args())
.arg(backup_control::arguments::suffix()) .arg(backup_control::arguments::suffix())
.arg(update_control::arguments::update())
.arg(update_control::arguments::update_no_args())
.arg( .arg(
Arg::new(options::REFLINK) Arg::new(options::REFLINK)
.long(options::REFLINK) .long(options::REFLINK)