1

I'm trying to build a command line interface, which accepts two lists of unknown size as parameters.

It is supposed to look something like this:

gitalizer plot something --users user1 user2 user3 --repository repo1 repo2 repo3

I'm using Click for designing the CLI and I'm facing an, in my opinion, weird limitation.

click.argument allows to specify nargs=-1, but it's impossible to have multiple click.arguments with nargs=-1 since we can't determine where one argument ends and the other begins.

click.option would seem to be obvious choice for this, but somehow click.option doesn't support nargs=-1 and always needs a fix size of arguments.

My question is now: How do I build a CLI with click in such a way that it accepts two lists of unknown size.

Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
Nukesor
  • 945
  • 1
  • 7
  • 13

0 Answers0