# HG changeset patch # User Brian Neal # Date 1337453858 18000 # Node ID 2c88867c48756b78c1046375812237d23ed8132f # Parent ce84c480ffecde85c0dba2ae23c445fe534b2035 Improve help text. diff -r ce84c480ffec -r 2c88867c4875 weighmail/main.py --- a/weighmail/main.py Sat May 19 13:34:24 2012 -0500 +++ b/weighmail/main.py Sat May 19 13:57:38 2012 -0500 @@ -7,6 +7,14 @@ PROG_DESC = "Adds labels to your Gmail according to message size" +HELP_EPILOG = """Command-line arguments override config file settings. + +A simple example to label messages between 1 and 5 MB as "big" and +messages over 5 MB as "huge": + +$ %(prog)s --labels big:1MB-5MB huge:5MB- + +""" class LabelAction(argparse.Action): @@ -29,17 +37,22 @@ def parse_args(): - parser = argparse.ArgumentParser(description=PROG_DESC, - epilog="Command-line arguments override config file settings.") + parser = argparse.ArgumentParser(description=PROG_DESC, epilog=HELP_EPILOG, + formatter_class=argparse.RawDescriptionHelpFormatter) parser.add_argument('-c', '--config', help="path to configuration file") - parser.add_argument('-f', '--folder', help="mail folder to search") - parser.add_argument('-u', '--user', help="user name") - parser.add_argument('-p', '--password', help="password") - parser.add_argument('-H', '--host', help="server name") - parser.add_argument('-P', '--port', type=int, help="server port") + parser.add_argument('-f', '--folder', + help="mail folder to search [default: All Mail]") + parser.add_argument('-u', '--user', + help="user name [default: prompted]") + parser.add_argument('-p', '--password', + help="password [default: prompted]") + parser.add_argument('-H', '--host', + help="server name [default: imap.gmail.com]") + parser.add_argument('-P', '--port', type=int, + help="server port [default: 993]") parser.add_argument('-n', '--nossl', default=None, action='store_true', - help="do not use SSL") + help="do not use SSL [default: SSL is used]") parser.add_argument('-l', '--labels', default=[], nargs='+', action=LabelAction, help="label specification: name:min-max")