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

chore(deps): update clap #1924

Merged
merged 10 commits into from
May 15, 2024
Merged

chore(deps): update clap #1924

merged 10 commits into from
May 15, 2024

Conversation

poliorcetics
Copy link
Contributor

@poliorcetics poliorcetics commented Feb 23, 2024

Steps:

  • Move from clap 2 to 3
    • Make it compile
    • Make all tests pass
  • Resolve deprecation warnings
    • Make it compile
    • Make all tests pass
  • Move from clap 3 to 4
    • Make it compile
    • Make all tests pass

I know there is #1865 but I think it does it too quickly to make it possible. I'm following the changelog instructions from clap: https://github.com/clap-rs/clap/blob/master/CHANGELOG.md#migrating, which makes it simpler

@poliorcetics
Copy link
Contributor Author

Note: current commit has a deprecation warning already, the fix is planned for the next commit where I'll resolve such warnings

@casey
Copy link
Owner

casey commented Feb 23, 2024

Nice, this is a great approach, because it makes each commit easy to review independently.

The completion scripts are probably going to be a huge problem. The completion scripts are generated by clap, but then we patch them to add features. So if the completion scripts have changed a lot, those patchs might not apply cleaning, and would be hard to resolve.

If going from clap v3 to clap v4 winds up being hard, we can also merge just the move from v2 to v3.

@poliorcetics
Copy link
Contributor Author

The completion scripts are probably going to be a huge problem. The completion scripts are generated by clap, but then we patch them to add features. So if the completion scripts have changed a lot, those patchs might not apply cleaning, and would be hard to resolve.

The issue is not the cleaning, I fixed that easily enough, I just can't get clap_complete to output to anything but stdout, which is obviously annoying for us. It happens with clap 3 too, so even that upgrade is blocked

@casey
Copy link
Owner

casey commented Feb 26, 2024

Which function generates the completion script, and which version of clap_complete? Looking at the latest clap_complete, it looks like the generate function takes a writer to write to. clap_complete::generator::generate.

@poliorcetics
Copy link
Contributor Author

Look at clap-rs/clap#5372 for details, it's not related to just's usage of it but is a wider issue

@tgross35 tgross35 mentioned this pull request Mar 4, 2024
@tgross35
Copy link
Contributor

tgross35 commented Mar 4, 2024

To workaround that issue, could you generate the completion scripts in build.rs, patch them there, then include_str! them as needed?

@poliorcetics
Copy link
Contributor Author

Found the issue, I'll fix it and continue this pr

@poliorcetics poliorcetics marked this pull request as ready for review March 12, 2024 00:11
@poliorcetics
Copy link
Contributor Author

Okay I think I did everything I was supposed to for a clean clap upgrade (congrats to the clap changelog, it's very well made) so this is ready for review :D

@casey casey merged commit caace0a into casey:master May 15, 2024
5 checks passed
@casey
Copy link
Owner

casey commented May 15, 2024

Looks good to me! Thank you for the epic PR!

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