vacuumlabs/cardano-hw-cli

Add support for mutually exclusive groups of arguments to command parser

Closed this issue · 1 comments

The intention was originally discussed here

The library for parsing command line arguments we use is argparse and it's supposed to be similar to the Python one.

It should have a built in support for mutually exclusive groups of arguments which could come in handy for example in the address show command where we require the user to specify exactly one of --payment-path or --payment-script-hash argument.

Currently we do not enforce it, but if the argparse supports it we should probably enforce it.

It could be helpful add @types/argparse package to devDependencies for better type support for the argparse package.

Also Mazo commented, and here

Perhaps we can get pass the whole ParsedShowAddressArguments? (Seems we do something like that for txs.) Some of the arguments are mutually exclusive, so it's a bit odd to pass them all anyway.
it would also be good to modify the type for arguments passed to the command executor and then crypto providers to reflect this mutual exclusivity.