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

feat: propagate doc comments on flags and arguments to --help/-h + structs derive refactor #26

Merged
merged 60 commits into from
Feb 11, 2025

Conversation

dj8yfo
Copy link
Contributor

@dj8yfo dj8yfo commented Dec 12, 2024

the crux of the pr is 0c3ce3a
and 912744d

the rest is some refactoring and splitting big chunks of code into smaller and nested modules/functions


the changes to the logic of derives aren't many and are well summarised by
the following list of commits with snapshot differences
from the same tests as added to master branch in
https://github.com/dj8yfo/interactive-clap/commits/backporting_tests_into_master/ branch:


second (or 3rd) sub-summary mentions 2 commits 382cc33, 3db17e1 which made
a testing step automatic and not requiring to manually copy-paste a fragment
from snapshot generated with first test assertion.
No snapshots changed as result of these latter 2 commits.

@dj8yfo
Copy link
Contributor Author

dj8yfo commented Dec 12, 2024

introspect feature can be used to debug how derive proc macros work similar to the following:

# interactive-clap-derive folder
cargo test test_doc_comments_propagate --features introspect -- --nocapture 
# from repo root
cargo run --example struct_with_subargs --features interactive-clap-derive/introspect 

@dj8yfo dj8yfo marked this pull request as ready for review December 13, 2024 18:17
@frol frol requested a review from FroVolod December 22, 2024 19:29
@dj8yfo dj8yfo marked this pull request as draft January 6, 2025 20:07
@dj8yfo
Copy link
Contributor Author

dj8yfo commented Jan 6, 2025

this is still draft, pending some small work on top of it

@dj8yfo dj8yfo force-pushed the propagate_doc_comments_on_flags branch from a6406da to 1d16e9b Compare January 6, 2025 20:30
@dj8yfo dj8yfo mentioned this pull request Jan 9, 2025
@dj8yfo dj8yfo force-pushed the propagate_doc_comments_on_flags branch from 2008066 to f1ad05f Compare January 24, 2025 18:09
@dj8yfo
Copy link
Contributor Author

dj8yfo commented Feb 6, 2025

@race-of-sloths include

@race-of-sloths
Copy link

race-of-sloths commented Feb 6, 2025

@dj8yfo Thank you for your contribution! Your pull request is now a part of the Race of Sloths!
Do you want to apply for monthly streak? Get 8+ score for a single PR this month and receive boost for race-of-sloths!

Shows inviting banner with latest news.

Shows profile picture for the author of the PR

Current status: executed
Reviewer Score
@akorchyn 13

Your contribution is much appreciated with a final score of 13!
You have received 288 (130 base + 120 monthly bonus + 15% lifetime bonus) Sloth points for this contribution

@akorchyn received 25 Sloth Points for reviewing and scoring this pull request.

Congratulations @dj8yfo! Your PR was highly scored and you completed another monthly streak! To keep your monthly streak make another pull request next month and get 8+ score for it

What is the Race of Sloths

Race of Sloths is a friendly competition where you can participate in challenges and compete with other open-source contributors within your normal workflow

For contributors:

  • Tag @race-of-sloths inside your pull requests
  • Wait for the maintainer to review and score your pull request
  • Check out your position in the Leaderboard
  • Keep weekly and monthly streaks to reach higher positions
  • Boast your contributions with a dynamic picture of your Profile

For maintainers:

  • Score pull requests that participate in the Race of Sloths and receive a reward
  • Engage contributors with fair scoring and fast responses so they keep their streaks
  • Promote the Race to the point where the Race starts promoting you
  • Grow the community of your contributors

Feel free to check our website for additional details!

Bot commands
  • For contributors
    • Include a PR: @race-of-sloths include to enter the Race with your PR
  • For maintainers:
    • Invite contributor @race-of-sloths invite to invite the contributor to participate in a race or include it, if it's already a runner.
    • Assign points: @race-of-sloths score [1/2/3/5/8/13] to award points based on your assessment.
    • Reject this PR: @race-of-sloths exclude to send this PR back to the drawing board.
    • Exclude repo: @race-of-sloths pause to stop bot activity in this repo until @race-of-sloths unpause command is called

Copy link
Member

@akorchyn akorchyn left a comment

Choose a reason for hiding this comment

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

I'll return back to it a bit later. Hard to keep up :)

@akorchyn
Copy link
Member

akorchyn commented Feb 7, 2025

Can you create a patch for near-cli-rs and check that it's starting speed is sufficient and not struggle as Vlad described on a call?

@dj8yfo
Copy link
Contributor Author

dj8yfo commented Feb 7, 2025

@akorchyn patch was created near/near-cli-rs#444 , the starting lag is (visually) the same as in main

Co-authored-by: Artur Yurii Korchynskyi <42449190+akorchyn@users.noreply.github.com>
@dj8yfo dj8yfo marked this pull request as draft February 10, 2025 15:33
dj8yfo pushed a commit to dj8yfo/interactive-clap that referenced this pull request Feb 10, 2025
@dj8yfo dj8yfo force-pushed the propagate_doc_comments_on_flags branch from 793bc83 to c9cce06 Compare February 10, 2025 21:39
@dj8yfo dj8yfo marked this pull request as ready for review February 10, 2025 21:50
Copy link
Member

@akorchyn akorchyn left a comment

Choose a reason for hiding this comment

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

Small nit. Feel free to ignore.

I think, we should avoid to make refactoring and feature addition in the same PR, but I also tend to do the same.

@race-of-sloths score 13

@@ -19,7 +20,8 @@ pub fn fn_choose_variant(
let mut ast_attrs: Vec<&str> = std::vec::Vec::new();

if !ast.attrs.is_empty() {
for attr in ast.attrs.clone() {
for (_index, attr) in ast.attrs.clone().into_iter().enumerate() {
Copy link
Member

@akorchyn akorchyn Feb 11, 2025

Choose a reason for hiding this comment

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

can be used already as index, but doesn't matter (without _)

@dj8yfo dj8yfo merged commit 962ddb9 into near-cli-rs:master Feb 11, 2025
3 checks passed
@frol frol mentioned this pull request Jan 7, 2025
akorchyn pushed a commit that referenced this pull request Feb 11, 2025
## 🤖 New release

* `interactive-clap-derive`: 0.3.1 -> 0.3.2
* `interactive-clap`: 0.3.1 -> 0.3.2 (✓ API compatible changes)

<details><summary><i><b>Changelog</b></i></summary><p>

## `interactive-clap-derive`

<blockquote>

##
[0.3.2](interactive-clap-derive-v0.3.1...interactive-clap-derive-v0.3.2)
- 2025-02-11

### Added

- propagate doc comments on flags and arguments to `--help/-h` + structs
derive refactor (#26)

### Other

- Added code style check (#29)
</blockquote>

## `interactive-clap`

<blockquote>

##
[0.3.2](interactive-clap-v0.3.1...interactive-clap-v0.3.2)
- 2025-02-11

### Added

- propagate doc comments on flags and arguments to `--help/-h` + structs
derive refactor (#26)

### Other

- Added "cargo test" command (#33)
- Added clippy to examples (#31)
- Added code style check (#29)
- add CODEOWNERS (#27)
- Added a demo image to README (#24)
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).
dj8yfo added a commit to near/cargo-near that referenced this pull request Feb 13, 2025
this resolves 

![2025-02-05_21-15](https://github.com/user-attachments/assets/1c150f4e-9e27-4fa4-8da4-1eb128cb606f)
from within the tool itself

depends on near-cli-rs/interactive-clap#26, so
that would have to be merged+released first

---------

Co-authored-by: dj8yf0μl <noreply@nowhere.org>
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