#! /usr/bin/env python

import sys
import logging
import argparse

parser = argparse.ArgumentParser(description=sys.argv[0], add_help=False)
parser.add_argument('-v', '--verbose', dest='verbose', action='store_true', help='Enable debugging')

parent1 = argparse.ArgumentParser(parents=[parser])
parent1.add_argument('-a', '--add', action='store_true', help='add')
parent1.add_argument('name', help='name')

parent2 = argparse.ArgumentParser(parents=[parser])
parent2.add_argument('-l', '--list', action='store_true', help='list')

args = parser.parse_args()

logging.basicConfig(format='%(asctime)s %(levelname)s %(pathname)s:%(lineno)d %(msg)s')
log = logging.getLogger()
log.setLevel(logging.DEBUG if args.verbose else logging.WARNING)

log.info(args)
