Skip to content

Implement Default for Options of mv and cp #7506

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

Merged
merged 3 commits into from
Mar 20, 2025
Merged

Conversation

jmjoy
Copy link
Contributor

@jmjoy jmjoy commented Mar 20, 2025

Resolve #7502

This pull request includes several changes to the cp, mv, and uucore utilities, focusing on adding Default implementations to various enums and structs.

The selection of default values is based on the values that would be set when no flag are passed in the command line.

Key changes include:

Enhancements to cp utility:

  • Added Default implementations for enums ClobberMode, OverwriteMode, ReflinkMode, SparseMode, CopyMode, and struct Attributes. This simplifies the initialization of these types. [1] [2] [3] [4] [5]
  • Added a Default implementation for the Options struct, setting default values for all fields.
  • Replaced custom initialization logic with the Default trait for ReflinkMode in the Options struct.

Enhancements to mv utility:

  • Added a Default implementation for the Options struct, setting default values for all fields.
  • Added a Default implementation for the OverwriteMode enum.

Enhancements to uucore library:

  • Added a Default implementation for the BackupMode enum and replaced the hardcoded backup suffix with a constant DEFAULT_BACKUP_SUFFIX. [1] [2]
  • Added a Default implementation for the UpdateMode enum.

@sylvestre
Copy link
Contributor

@dmatos2012 you will like this :)

Copy link

GNU testsuite comparison:

GNU test failed: misc/stdbuf.log. misc/stdbuf.log is passing on 'main'. Maybe you have to rebase?
Congrats! The gnu test timeout/timeout.log is no longer failing!

@sylvestre
Copy link
Contributor

A few jobs have been falling

Copy link

GNU testsuite comparison:

Congrats! The gnu test timeout/timeout.log is no longer failing!

@sylvestre sylvestre merged commit 7bd90bb into uutils:main Mar 20, 2025
68 checks passed
@jmjoy jmjoy deleted the default branch March 20, 2025 15:22
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.

2 participants