Skip to content

Conversation

@davlgd
Copy link
Contributor

@davlgd davlgd commented Nov 17, 2025

This PR migrates from Clap 3.2 to Clap 4.5, updating all deprecated APIs and syntax to follow Clap 4.x conventions.

Core Updates

Attribute syntax changes:

  • value_name("FOO")value_name = "FOO"
  • conflicts_with("foo-bar")conflicts_with("foo_bar") (underscore naming)
  • requires("foo-bar")requires("foo_bar")

Custom parsers:

  • parse(try_from_str = func)value_parser = clap::builder::ValueParser::new(func)
  • Applied to parse_ttl, parse_duration, parse_rule, and parse_param

Path handling:

  • Removed parse(from_os_str) for PathBuf arguments (auto-detected in Clap 4)

Type System Updates

Import changes:

  • clap::PossibleValueclap::builder::PossibleValue

Trait implementation:

  • ValueEnum::to_possible_value() signature simplified (removed explicit lifetime)

Type derivations:

  • Added Clone to Ttl enum for value_parser compatibility

I've tested this against tests from #76 and a bash script generating outputs of multiple commands to look for any differences. I didn't notice any, except those linked to different Clap 4.x helpers style.

@divarvel
Copy link
Contributor

there’s a small formatting error it seems. could you run cargo fmt and update the pr please?

@davlgd davlgd closed this by deleting the head repository Jan 4, 2026
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.

2 participants