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
  • 40,722
  • 30
  • 82
  • 105
Nukesor
  • 734
  • 6
  • 11

0 Answers0