From: Mikael Frykholm Date: Mon, 18 Feb 2013 17:08:18 +0000 (+0100) Subject: nicer argument parseing X-Git-Url: https://git.frykholm.com/svtplaydump.git/commitdiff_plain/1ad04c01970bcfc05677e0fc78eb7e426fe9305e nicer argument parseing --- diff --git a/svtplaydump.py b/svtplaydump.py index 80ee0b2..9246405 100755 --- a/svtplaydump.py +++ b/svtplaydump.py @@ -156,12 +156,11 @@ def parse_videolist(): if __name__ == "__main__": parser = argparse.ArgumentParser() - parser.add_argument("-r", "--rss", help="Download all files in rss") - parser.add_argument("-u", "--url", help="Download video in url") - parser.add_argument("-m", "--mirror", help="Mirror all files", action="store_true") - + group = parser.add_mutually_exclusive_group(required=True) + group.add_argument("-r", "--rss", help="Download all files in rss") + group.add_argument("-u", "--url", help="Download video in url") + group.add_argument("-m", "--mirror", help="Mirror all files", action="store_true") args = parser.parse_args() - if args.rss: d = feedparser.parse(args.url) for e in d.entries: