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

find: Implement -anewer and -cnewer. #386

Merged
merged 6 commits into from
May 22, 2024
Merged

Conversation

hanbings
Copy link
Collaborator

implement: #370

Added extra judgment to parse_str_to_newer_args() function.

  1. -anewer is equivalent to -neweram
  2. -cnewer is equivalent to -newercm
  3. -newer is equicalent to -newermm

BFS test +1 PASS in commit 57f2a3b.

This PR does not solve Parsing multiple time formats, I will open a new PR to handle it separately. : )

@hanbings hanbings marked this pull request as ready for review May 18, 2024 07:11
Copy link

codecov bot commented May 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 59.04%. Comparing base (92c6059) to head (fc02681).
Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #386      +/-   ##
==========================================
+ Coverage   58.70%   59.04%   +0.33%     
==========================================
  Files          30       30              
  Lines        3821     3855      +34     
  Branches      841      850       +9     
==========================================
+ Hits         2243     2276      +33     
- Misses       1254     1255       +1     
  Partials      324      324              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@cakebaker cakebaker linked an issue May 18, 2024 that may be closed by this pull request
Comment on lines 525 to 532
#[cfg(target_os = "linux")]
let x_options = ["a", "c", "m"];
#[cfg(not(target_os = "linux"))]
let x_options = ["a", "B", "c", "m"];
#[cfg(target_os = "linux")]
let y_options = ["a", "c", "m"];
#[cfg(not(target_os = "linux"))]
let y_options = ["a", "B", "c", "m"];
Copy link
Contributor

Choose a reason for hiding this comment

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

As x_options and y_options contain the same values, I think it is unnecessary to have two vars. And so my suggestion is to simply use options.


for &x in &x_options {
for &y in &y_options {
let arg = &format!("-newer{x}{y}").to_string();
Copy link
Contributor

Choose a reason for hiding this comment

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

Calling to_string() is unnecessary because format! already returns a string.

Suggested change
let arg = &format!("-newer{x}{y}").to_string();
let arg = &format!("-newer{x}{y}");

Comment on lines 534 to 535
for &x in &x_options {
for &y in &y_options {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the references are not necessary and you can simply use for x in x_options.

Comment on lines 556 to 558
for &arg in &args {
for &time in &times {
let arg = &format!("{arg}{time}").to_string();
Copy link
Contributor

Choose a reason for hiding this comment

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

See my previous comments.

@hanbings
Copy link
Collaborator Author

Thanks. I'm sorry for these issues, they have been fixed in new commits.

@cakebaker cakebaker merged commit 0693242 into uutils:main May 22, 2024
18 checks passed
@hanbings hanbings deleted the implement-370 branch May 22, 2024 15:00
@cakebaker
Copy link
Contributor

Thanks. There's no need to be sorry, the things I mentioned are minor details ;-) And it's great that you fixed them in time.rs, too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement -anewer and -cnewer
2 participants