-
Notifications
You must be signed in to change notification settings - Fork 33
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
[DOC] More on cp_r #87
Conversation
lib/fileutils.rb
Outdated
# |-- dir0 | ||
# | |-- src0.txt | ||
# | `-- src1.txt | ||
# `-- dir1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this line's indentation is off by one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
lib/fileutils.rb
Outdated
@@ -817,7 +817,8 @@ def cp(src, dest, preserve: nil, noop: nil, verbose: nil) | |||
alias copy cp | |||
module_function :copy | |||
|
|||
# Recursively copies files from +src+ to +dest+. | |||
# Recursively copies files from +src+ (a single path or an array of paths) | |||
# to +dest+ (a single path). | |||
# | |||
# Arguments +src+ and +dest+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For consistency, I think we should specify here that src
is a single or an array of paths and dest
is a single path.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't that what it says?
Recursively copies files from +src+ (a single path or an array of paths)
to +dest+ (a single path).
Maybe 820-824 should be rolled together?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The docs for this method says:
Recursively copies files from +src+ (a single path or an array of paths)
to +dest+ (a single path).Arguments +src+ and +dest+
should be {interpretable as paths}[rdoc-ref:FileUtils@Path+Arguments].
Whereas, for example, the docs for ln_s
says:
Creates {symbolic links}[https://en.wikipedia.org/wiki/Symbolic_link].
Arguments +src+ (a single path or an array of paths)
and +dest+ (a single path)
should be {interpretable as paths}[rdoc-ref:FileUtils@Path+Arguments].
So yeah, perhaps we can remove duplication in the docs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
@peterzhu2118, I have not provided an example for cp_r with multiple dirpaths in +src+ b/c it would be huge. Should I add one? |
I agree. I don't think it's necessary to have an example for that. |
I have not provided an example for cp_r with multiple dirpaths in +src+ b/c it would be huge. Should I add one?
If +src+ is an array of paths and +dest+ is a directory,
recursively copies from each path in +src+ to +dest+;
the paths in +src+ may point to files and/or directories.