Mercurial > public > weighmail
changeset 5:2c88867c4875
Improve help text.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Sat, 19 May 2012 13:57:38 -0500 |
parents | ce84c480ffec |
children | 470bfed5411e |
files | weighmail/main.py |
diffstat | 1 files changed, 21 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- 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")