def main():
    description = 'Package Compare/Verifier tool.'
parser = argparse.ArgumentParser(usage=None, description=description)
maingroup = parser.add_argument_group(title='required')
maingroup.add_argument('-f', '--file', nargs=1, dest='outFileName', help=
    'File Name where result is stored.', metavar='outFileName', required=True)
exgroup = parser.add_argument_group(title='one or the other')
group = exgroup.add_mutually_exclusive_group(required=True)
group.add_argument('-c', '--compare', nargs=2, dest='packageInfo', help=
    'Compare two packages.', metavar=('Package1', 'Package2'))
group.add_argument('-v', '--verify', nargs=1, dest='packageName', help=
    'Verify Content of package.', metavar='Package')
args = parser.parse_args()
How to code argparse combinational options in python