Author michelsen
Recipients loewis, michelsen
Date 2010-12-11.16:32:21
SpamBayes Score 3.97875e-11
Marked as misclassified No
Message-id <>
Okay, I'll try:

Save the following code as

#! /usr/bin/env python2

import argparse

def args_config(about):
    parser = argparse.ArgumentParser(description=about)
    dummy_group = parser.add_argument_group(title='mutually exclusive')
    test_group = dummy_group.add_mutually_exclusive_group()
    test_group.add_argument('-a', action='store_true', default=False, \
        help='This is the r option')
    test_group.add_argument('-b', action='store_true', default=False, \
        help='This is the b option')
    test_group.add_argument('-c', action='store_true', default=False, \
        help='And this is the c option')
    args_ns = parser.parse_args()
    return args_ns

about = 'This is a test case'
args_ns = args_config(about)
print args_ns

The use the -h argument to see help output:

[~] python/ -h
usage: [-h] [-a] [-b] [-c]

This is a test case

optional arguments:
  -h, --help  show this help message and exit

mutually exclusive:
  -a          This is the r option
  -b          This is the b option
  -c          And this is the c option

The run it with all the options together to test exclusivity:

[~] python/ -abc
Namespace(a=True, b=True, c=True)

What happens: As you can see, there are no objections to using all three options at the same time. Neither does the help output indicate that there should be.

What should happen:
If I have understood the instructions in the Issue report on Google correctly, the assumption is that this workaround (i.e. using a dummy group) should produce the desired result (i.e. that running the command -abc" should appear as and be prbohibited)
Date User Action Args
2010-12-11 16:32:24michelsensetrecipients: + michelsen, loewis
2010-12-11 16:32:24michelsensetmessageid: <>
2010-12-11 16:32:21michelsenlinkissue10680 messages
2010-12-11 16:32:21michelsencreate