someprog [-h] [([-f FROM] [-t TO]) | --period PERIOD]
usage: someprog [-h] [-f FROM] [-t TO] [--period PERIOD]
parser = argparse.ArgumentParser( description="%(prog)s - Utility to tisplays information about historical xxxx usage", epilog="Run %(prog)s", prog="someprog") parser.add_argument('-f', '--from', help='run report from date and time in YYYY-MM-DD HH:MM format; if not present last 10 minutes ' 'are assumed') parser.add_argument('-t', '--to', help='run report up to date and time in YYYY-MM-DD HH:MM format; if not present, reports ' 'results up to now') parser.add_argument('--period', help='time period; specify minutes with m, h - hours, days with d, and values: today, ' 'yesterday; 5m - last 5 minutes, 4h -- last four hours, 2d - last 2 days, as well as today')
вместе –period с –from или –to не может быть
Есть .add_mutually_exclusive_group() но там все аргументы взаимоисключающие :(