Skip to content

Conversation

bombsimon
Copy link

This will update clap to v4 and replace the deprecated yaml macro with a struct derive macro.


Thanks for this very useful tool and library. When using this to infer jtd schemas from code and not the actual cli tool I noticed that the clap package uses an old version that depends on yaml-rust which has a known vulnerability.

I thought about putting the cli behind a feature flag but figured it was easier to maintain to just bump clap version. Let me know if you rather use a feature flag or any other approach.

All flags and names are the same but moving to v4 will change two things in the --help output

  • No color support. Afaik there's currently no working color support in v4.
    I tried setting color = ColorChoice::Always which compiles but doesn't add colored output.
  • The output looks different
    I did a template but could not make a 1:1 map since v4 groups FLAGS and OPTIONS together. It also handles line breaks of help text differently. Below is the closest template I could make. Since I couldn't map it 1:1 I figured I just use the v4 default output instead.
const HELP_TEMPLATE: &str = "{bin} {version}

USAGE:
    {usage}

OPTIONS:
{options}

ARGS:
{positionals}
";

This will update clap to v4 and replace the deprecated yaml macro with a
struct derive macro.
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