Clap_derive v4 default_missing_value

I'm trying to configure my CLI to handle the following command: cmd foo.txt bar.txt --sort as if the user had typed cmd foo.txt bar.txt --sort=100

A GitHub issue led me to this method in the clap API:

However, I'm struggling to get it working with the derive API.

error: a value is required for '--sort ' but none was supplied

Any help would be greatly appreciated!

NOTE: using this configuration option requires the use of the .num_args(0..N) and the .require_equals(true) configuration option. These are required in order to unambiguously determine what, if any, value was supplied for the argument.

From your linked documentation

But I get a panic when trying to follow that note:

Arg::is_takes_value_set is required when Arg::is_require_equals_set is set

Can't find the solution to that, someone with more up to date clap experience might recognise the problem

Thanks for pointing that out. I think I figured out how to use the API.

(Unfortunate to see yet another real-world example of challenges hindering type-safe API design, but that's a discussion for another time)