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

Migrate to clap 4.x (WIP) #123

Merged
merged 8 commits into from
May 15, 2024
Merged

Conversation

schneiderfelipe
Copy link
Contributor

@schneiderfelipe schneiderfelipe commented Mar 30, 2024

This PR migrates to clap 4.3. This in particular requires/benefits from some changes to/on how some errors work, including depending on thiserror; I believe those are good changes overall.

I plan on doing the following in this PR:

  • migrate to clap 4.x
  • migrating errors to use thiserror
  • some glitter (use of Self and of format! only)
  • removing tests that check some CLI validation errors; they currently reflect the state of the PR though, so you can see how CLI error messages differ those changes have been isolated in the last commit

Please let me know what you think @noeddl, in particular on the last point.

@noeddl
Copy link
Owner

noeddl commented Mar 31, 2024

Thanks a lot for the PR @schneiderfelipe! It looks good to me on first glance but I will take a closer look later when I have some more time, especially on the failing checks. I will probably have to update the minimum supported Rust version to allow for clap 4.

As for testing CLI validation errors: Did clap 4 improve anything in this regard or would you consider these tests superfluous no matter which clap version?

@schneiderfelipe
Copy link
Contributor Author

Thanks a lot for the PR @schneiderfelipe! It looks good to me on first glance but I will take a closer look later when I have some more time, especially on the failing checks.

Some of the checks are failing due to -D warnings. In fact, some of those fail on unmodified code, maybe due to new clippy warnings having been added in the last couple years? I have some changes on my side addressing those (and other) clippy warnings, but I believe that would be outside the scope of this PR (I'm happy to contribute some of those soon 🤗)?

I will probably have to update the minimum supported Rust version to allow for clap 4.

I think the MSRV for clap 4.3 (what this PR is asking for) is 1.64.0. For comparison, clap 4.0 seems to ask for 1.60.0, so that's the interval we could choose from? cargo msrv gave me 1.64.0 if I remember correctly.

As for testing CLI validation errors: Did clap 4 improve anything in this regard or would you consider these tests superfluous no matter which clap version?

That's because some of those validations used to happen here, but since they are being proposed to happen on clap side (e.g. see here), I suggest these tests could be removed.

@noeddl
Copy link
Owner

noeddl commented Apr 1, 2024

I suggest that we first update the MSRV to 1.64.0 and make sure all the checks are passing (i.e. by addressing the clippy warnings) in a separate PR. Then we can rebase this PR on the new master after the other one has been merged. What do you think? If you want to you could do that using the changes that you already have in place regarding the clippy warnings.

That's because some of those validations used to happen here, but since they are being proposed to happen on clap side (e.g. see here), I suggest these tests could be removed.

I see, thanks for the clarification.

@schneiderfelipe
Copy link
Contributor Author

Good call, I can do that just fine. In the meanwhile, can I ask you to rerun the CI workflow on the master branch, so that we can have a baseline?

@noeddl
Copy link
Owner

noeddl commented Apr 2, 2024

I had to update the CI to allow for manually triggering it in the future but now the checks have in any case run on master. 🙂 Looks like they fail at the same places as when running on this PR except for the 1.56.0 job - which is what was to be expected.

@noeddl
Copy link
Owner

noeddl commented May 7, 2024

Hi @schneiderfelipe, are you still interested in doing the preparations that we discussed above (updating the MSRV and taking care of the clippy warnings)? Otherwise I would like to do them myself so that I can merge this PR and allow for any further development.

@schneiderfelipe
Copy link
Contributor Author

schneiderfelipe commented May 7, 2024 via email

@noeddl noeddl merged commit 563a22c into noeddl:master May 15, 2024
6 checks passed
@noeddl
Copy link
Owner

noeddl commented May 15, 2024

@schneiderfelipe Thanks again for the PR and thanks for bringing back some life to this project. 🙂

@schneiderfelipe schneiderfelipe deleted the migrate-to-clap4 branch May 15, 2024 11:54
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