Skip to content

Conversation

@jdx
Copy link
Owner

@jdx jdx commented Feb 11, 2026

Summary

  • Add support for help, long_help, help_long, help_md, required, var, var_min, var_max, hide, and double_dash as child nodes inside {} blocks for arg definitions
  • Previously only choices, env, and default were supported as child nodes, causing parse errors for other properties
  • Matches the existing pattern used in SpecFlag::parse()

Test plan

  • Added test_arg_child_nodes test verifying help, choices, var, and var_min as child nodes
  • Added test_arg_long_help_child_node test verifying help and long_help as child nodes
  • All 153 usage-lib tests pass

🤖 Generated with Claude Code


Note

Low Risk
Additive parsing support in SpecArg::parse plus tests; low risk aside from potentially changing behavior for specs that previously errored or relied on unsupported child nodes.

Overview
SpecArg::parse now accepts common argument attributes (e.g. help, long_help/help_long, help_md, required, var + var_min/var_max, hide, double_dash) as child nodes inside arg { ... } blocks, instead of erroring on them.

Adds new tests verifying mixed child-node parsing (including choices) and long_help parsing for args.

Written by Cursor Bugbot for commit bcb2fa9. This will update automatically on new commits. Configure here.

Copilot AI review requested due to automatic review settings February 11, 2026 13:40
@gemini-code-assist
Copy link

Summary of Changes

Hello @jdx, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the flexibility of argument definitions by extending the parser to recognize a wider range of properties as child nodes. This change resolves previous limitations where only a few properties were supported, ensuring that arg definitions can now be more comprehensively configured directly within their blocks, leading to a more robust and consistent parsing experience across the library.

Highlights

  • Expanded arg definition support: Added support for help, long_help, help_long, help_md, required, var, var_min, var_max, hide, and double_dash as child nodes within {} blocks for arg definitions.
  • Improved parser consistency: The arg parser now aligns with the existing pattern used in SpecFlag::parse(), resolving previous parse errors for these properties.
  • New test coverage: Introduced test_arg_child_nodes and test_arg_long_help_child_node to verify the correct parsing of these new child node properties.
Changelog
  • lib/src/spec/arg.rs
    • Extended the SpecArg::parse method to handle additional child node properties such as help, long_help, required, var, var_min, var_max, hide, and double_dash.
    • Added new unit tests (test_arg_child_nodes and test_arg_long_help_child_node) to validate the correct parsing and assignment of these newly supported child node properties.
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds support for additional child nodes (help, long_help, help_long, help_md, required, var, var_min, var_max, hide, double_dash) inside {} blocks for arg definitions in the argument parser. Previously, only choices, env, and default were supported as child nodes.

Changes:

  • Extended SpecArg::parse() to handle 10 additional child node types
  • Added comprehensive test coverage for the new child node support

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +135 to +136
"long_help" => arg.help_long = Some(child.arg(0)?.ensure_string()?),
"help_long" => arg.help_long = Some(child.arg(0)?.ensure_string()?),
Copy link

Copilot AI Feb 11, 2026

Choose a reason for hiding this comment

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

Both long_help and help_long set the same field arg.help_long. This duplication suggests these are aliases, but it creates ambiguity about which one is the canonical name. Consider documenting this aliasing behavior or consolidating to a single name to improve clarity.

Copilot uses AI. Check for mistakes.
The arg parser only supported choices, env, and default as child nodes
inside {} blocks. Add support for help, long_help, help_long, help_md,
required, var, var_min, var_max, hide, and double_dash, matching the
pattern already used in the flag parser.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jdx jdx force-pushed the fix/arg-child-node-support branch from 366cb88 to bcb2fa9 Compare February 11, 2026 13:41
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly adds support for several previously unsupported child nodes in arg definitions, improving consistency within the parser. The changes are accompanied by new tests. I have two suggestions: one to refactor a small piece of duplicated code using an or-pattern, and another to enhance the new tests to cover both aliases for long_help, ensuring better test coverage.

Comment on lines +135 to +136
"long_help" => arg.help_long = Some(child.arg(0)?.ensure_string()?),
"help_long" => arg.help_long = Some(child.arg(0)?.ensure_string()?),

Choose a reason for hiding this comment

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

medium

To improve maintainability and reduce code duplication, you can use an or-pattern to handle both long_help and help_long in a single match arm.

Suggested change
"long_help" => arg.help_long = Some(child.arg(0)?.ensure_string()?),
"help_long" => arg.help_long = Some(child.arg(0)?.ensure_string()?),
"long_help" | "help_long" => arg.help_long = Some(child.arg(0)?.ensure_string()?),

Comment on lines +497 to +512
assert!(svc_arg.var);
assert_eq!(svc_arg.var_min, Some(0));
}

#[test]
fn test_arg_long_help_child_node() {
let spec = Spec::parse(
&Default::default(),
r#"
arg "<input>" {
help "Input file"
long_help "Extended help text for input"
}
"#,
)
.unwrap();

Choose a reason for hiding this comment

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

medium

To improve test coverage, this test should verify that both long_help and its alias help_long are parsed correctly as child nodes. You can do this by adding another argument definition to the spec string and asserting its properties.

    fn test_arg_long_help_child_node() {
        let spec = Spec::parse(
            &Default::default(),
            r#"
arg "<input>" {
    help "Input file"
    long_help "Extended help text for input"
}
arg "<input2>" {
    help "Input file 2"
    help_long "Extended help text for input 2"
}
            "#,
        )
        .unwrap();

        let input_arg = spec.cmd.args.iter().find(|a| a.name == "input").unwrap();
        assert_eq!(input_arg.help, Some("Input file".to_string()));
        assert_eq!(input_arg.help_long, Some("Extended help text for input".to_string()));

        let input_arg2 = spec.cmd.args.iter().find(|a| a.name == "input2").unwrap();
        assert_eq!(input_arg2.help, Some("Input file 2".to_string()));
        assert_eq!(input_arg2.help_long, Some("Extended help text for input 2".to_string()));
    }

@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

❌ Patch coverage is 81.13208% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.58%. Comparing base (1a9a880) to head (bcb2fa9).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
lib/src/spec/arg.rs 81.13% 3 Missing and 7 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #489      +/-   ##
==========================================
- Coverage   70.71%   69.58%   -1.13%     
==========================================
  Files          47       47              
  Lines        6716     6789      +73     
  Branches     6716     6789      +73     
==========================================
- Hits         4749     4724      -25     
- Misses       1277     1299      +22     
- Partials      690      766      +76     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jdx jdx merged commit ee4533e into main Feb 11, 2026
9 checks passed
@jdx jdx deleted the fix/arg-child-node-support branch February 11, 2026 13:45
jdx pushed a commit that referenced this pull request Feb 12, 2026
### 🐛 Bug Fixes

- **(lib)** add missing child node support to arg parser by
[@jdx](https://github.com/jdx) in
[#489](#489)
- **(release)** write release notes to file instead of capturing stdout
by [@jdx](https://github.com/jdx) in
[#488](#488)

### 📚 Documentation

- add opengraph meta tags by [@jdx](https://github.com/jdx) in
[#486](#486)

### 🔍 Other Changes

- add tone calibration to release notes prompt by
[@jdx](https://github.com/jdx) in
[#483](#483)

### 📦️ Dependency Updates

- lock file maintenance by
[@renovate[bot]](https://github.com/renovate[bot]) in
[#487](#487)
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.

1 participant