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

Introduce compressor field in Args for single compression input #52

Merged
merged 1 commit into from
Oct 17, 2023

Conversation

Daniil-Golikov
Copy link
Contributor

Following a suggestion by @rukai in #46, this PR aims to simplify the CLI input for compression types. Introducing a compressor field in the Args struct ensures:

  • A more streamlined and intuitive user experience.
  • Prevention of specifying multiple compression types, eliminating potential confusion and errors.

Benefits:

  • A simplified user input leading to a more robust CLI experience.
  • Reduced potential sources of errors and misinterpretations.

Considerations:

To improve our CLI, this PR introduces a new CompressorType enum, specifically designed for handling CLI inputs. This new enum is analogous to the existing Compressor enum with one critical difference: it derives the clap::ValueEnum trait necessary for CLI processing.

Reasoning:

While it's tempting to simply add the clap::ValueEnum trait to our core Compressor enum, doing so muddies its purpose. The Compressor enum's primary role is to define the various compressor types our system recognizes and supports, irrespective of CLI considerations. Infusing it with a trait designed solely for CLI interaction feels architecturally unsound and blurs its clear intent.

Feedback Welcome:

Any alternative suggestions or insights into reconciling the trait requirements without compromising architectural clarity are most welcome.

Note on Merging:

Given that there's another active PR targeting the exact same file, we can hold off on merging this one for now to avoid chaos.

Copy link
Contributor

@rukai rukai left a comment

Choose a reason for hiding this comment

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

Very nice!

Keeping CompressorType and Compressor type separate is a good idea, thanks for writing out your reasoning here.

For the next reviewer:
The --help output looks like this:
image

@cjrolo
Copy link
Collaborator

cjrolo commented Oct 17, 2023

I like this a lot, for a next iteration we will probably have to expand some of the compressors into subcommands. But that is for a future TODO.

This looks great.

@cjrolo cjrolo merged commit aad6fde into main Oct 17, 2023
2 checks passed
@Daniil-Golikov Daniil-Golikov deleted the compressor-cli-interface branch October 18, 2023 10:37
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.

3 participants