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

[DOC] More on cp_r #87

Merged
merged 2 commits into from
Jun 14, 2022
Merged

[DOC] More on cp_r #87

merged 2 commits into from
Jun 14, 2022

Conversation

BurdetteLamar
Copy link
Member

@BurdetteLamar BurdetteLamar commented Jun 14, 2022

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.

lib/fileutils.rb Outdated
# |-- dir0
# | |-- src0.txt
# | `-- src1.txt
# `-- dir1
Copy link
Member

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.

Copy link
Member Author

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+
Copy link
Member

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.

Copy link
Member Author

@BurdetteLamar BurdetteLamar Jun 14, 2022

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?

Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@BurdetteLamar
Copy link
Member Author

@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?

@peterzhu2118
Copy link
Member

I agree. I don't think it's necessary to have an example for that.

@BurdetteLamar BurdetteLamar merged commit 82a2b62 into ruby:master Jun 14, 2022
matzbot pushed a commit to ruby/ruby that referenced this pull request Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants