-
Notifications
You must be signed in to change notification settings - Fork 4
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
feat: propagate doc comments on flags and arguments to --help/-h
+ structs derive refactor
#26
Conversation
# 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 |
…nd `long_help` Add this functionality in commented form
this is still draft, pending some small work on top of it |
a6406da
to
1d16e9b
Compare
…nt_of_to_cli_trait module
… to derives::interactive_clap::structs::cli_variant_of_to_cli_trait::field
…ant_of_to_cli_trait`
2008066
to
f1ad05f
Compare
…riminants from `master`
@race-of-sloths include |
@dj8yfo Thank you for your contribution! Your pull request is now a part of the Race of Sloths! Current status: executed
Your contribution is much appreciated with a final score of 13! @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 SlothsRace 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:
For maintainers:
Feel free to check our website for additional details! Bot commands
|
There was a problem hiding this 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 :)
interactive-clap-derive/src/derives/interactive_clap/common_methods/choose_variant.rs
Outdated
Show resolved
Hide resolved
interactive-clap-derive/docs/clap_enum_for_named_arg_docstring.md
Outdated
Show resolved
Hide resolved
interactive-clap-derive/src/derives/interactive_clap/structs/clap_for_named_arg_enum.rs
Show resolved
Hide resolved
...ap-derive/src/derives/interactive_clap/structs/to_cli_trait/clap_parser_trait_adapter/mod.rs
Outdated
Show resolved
Hide resolved
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? |
@akorchyn patch was created near/near-cli-rs#444 , the starting lag is (visually) the same as in main |
...rc/tests/snapshots/interactive_clap_derive__tests__test_simple_struct__vec_multiple_opt.snap
Show resolved
Hide resolved
Co-authored-by: Artur Yurii Korchynskyi <42449190+akorchyn@users.noreply.github.com>
793bc83
to
c9cce06
Compare
There was a problem hiding this 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() { |
There was a problem hiding this comment.
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 _)
## 🤖 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/).
this resolves  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>
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 inhttps://github.com/dj8yfo/interactive-clap/commits/backporting_tests_into_master/ branch:
clap(verbatim_doc_comment)
propagated, fragments reordered)InteractiveClap
derive, test passingToCliArgs
resulted in test failingsecond (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.