1

I have a series of flags...

--one
--two

-a
-b
-c
-d

I would like to have -a and -b required whenever I start with --one and -c, -d whenever I start with --two.

How exactly do I accomplish this? I know I can make an option required, but that's not the same as requiring options based on already given options.

Atrus
  • 788
  • 4
  • 13
  • 34
  • 2
    I think this question answers your problem: http://stackoverflow.com/questions/9505898/conditional-command-line-arguments-in-python-using-argparse – wkl Apr 21 '12 at 15:37
  • 2
    It's probably simpler to check this yourself after parsing, or find an interface that's simpler and does not require *flags* at all (e.g. subcommands). –  Apr 21 '12 at 15:50
  • birryree, that post lead me to the answer, thanks! So, what's the protocol for a question like this then? Do I just delete it? – Atrus Apr 21 '12 at 17:23

0 Answers0