Skip to content

Conversation

@stillbeingnick
Copy link

This PR builds on the great work done by @kaladron and lays out the foundation to enable adding operations and options moving forward. Leveraging rust enums and building behavioral control with the enum dispatch pattern.

There are 3 critical pieces to this foundational layer.

TarParams

  • TarParams provides highline access to arguments passed in and some convenience to the options set by the user that are called during execution. This also serves as the functional place that clap arguments are processed from uu_main. ArgMatches are pumped in and TarParams, TarOptions, and the TarOperation pop out.

TarOptions

  • An enum used to capture arguments and potential subarguments passed in via clap and command line. Due to the overwhelming amount of options that tar has, we needed a way to store these while also potentially caputuring data that could be associated with that option. Like BlockingFactor might take in a u32, while Verbose is only a flag so its presentance in a list is enough, and a rust enum is the best way to handle this wide swath of possibilities. A Vec of these options is stored in TarParams and created when TarParams::with_operation() is called.

TarOperation

  • This trait serves as the execution hook from processing from clap ArgMatchees to execution. Each Main Operation mode is created as a file (create.rs, extract.rs) and each of these have a new type associated with their respected operation. Which then impl the TarOperation trait and the exec method. This gives us a place to call our main operation modes and decouple each operation from one another, but also allowing the reuse of operations in other operations. For example, using append in the update operation.

While this is just the bones it will continue to morph and change as more functionality is built into tar.

@stillbeingnick
Copy link
Author

Just wanted to give this a bump, @kaladron or @sylvestre let me know if we need anything.

@stillbeingnick
Copy link
Author

Wanted to give this another bump @sylvestre @cakebaker. The PR after this I plan to rework the Clap arg processing so we can not only take care of @sylvestre suggestion to help make TarOperation more sane but also see if we can start addressing #55.

@kaladron
Copy link
Contributor

kaladron commented Dec 14, 2025 via email

@stillbeingnick
Copy link
Author

Sorry, it's performance review season at work and a lot of things in life are delayed at the moment.

On Sun, Dec 14, 2025, 18:55 Nicholas Still @.> wrote: stillbeingnick left a comment (uutils/tar#49) <#49 (comment)> Wanted to give this another bump @sylvestre https://github.com/sylvestre @cakebaker https://github.com/cakebaker. The PR after this I plan to rework the Clap arg processing so we can not only take care of @sylvestre https://github.com/sylvestre suggestion to help make TarOperation more sane but also see if we can start addressing #55 <#55>. — Reply to this email directly, view it on GitHub <#49 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAC4FO5SVFIW4Q42Y4RDUID4BWXAJAVCNFSM6AAAAACM7IZVVWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTMNJRHAYTANZUHA . You are receiving this because you were mentioned.Message ID: @.>

All good @sylvestre reviewed unless you are a maintainer now too @kaladron. But always open to more reviews.

Removing for match loop going over all matched args. Moved to standard if get_* for specific matches.
@stillbeingnick
Copy link
Author

stillbeingnick commented Dec 15, 2025

@cakebaker Thank you for the review! Items requested in the review are taken care of.

@stillbeingnick
Copy link
Author

Every time I somehow forget to run clippy and fmt! I need CI for my brain. Should be good to go now.

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.

4 participants