[clap] Implement new subcommand in terms of another plus predefined argument?

Consider a subcommand sha2 for a program computing a hash on some input. This subcommand allows for an argument that conveys the number of bits for the resulting digest:

        // some arguments ...
                 .about("Size of the resulting digest")
                 .possible_values(&["256", "384", "512"])

Is there a way to define a subcommand in terms of this one, say sha2-512 which will act as if I invoked this? (the ellipsis at the end are additional arguments):

binaryname sha2 -B 512 ...

So an invocation of my program like so:

binaryname sha2-512 ...

... should result in:

binaryname sha2 -B 512 ...

while keeping it as DRY as possible.

The version of clap I am using currently is 3.0.0-beta.2.

Thanks for your time!

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.