1

How do I set the arguments so that I get a mutually exclusive group, consisting of an '--more-info' parameter and a group of 3 other required params like '--arg1', '--arg2', '--arg3'?

In other words, how do I get this?

script.py [--more-info] [--arg1=something --arg2=something --arg3=something]

I want that users should either use '--more-info', OR use all of '--argn' parameters. I read the documentation for argparse, but it confused me even more when I had to achieve this. Any ideas?

Sohail Saha
  • 483
  • 7
  • 17
  • 2
    `argparse` does not provide anything like this. An `argument-group is just from help display, it does nothing special when parsing. The mutually-exclusive-group is a simple, flat xor test. – hpaulj Nov 17 '20 at 05:45
  • I think, you have to write custom logic. – Harsha Biyani Nov 17 '20 at 05:47

0 Answers0