Mercurial > cgi-bin > hgweb.cgi > curlyq
comparison curlyq @ 8:05363e803272 v1_workspace
Improve help text.
author | David Barts <n5jrn@me.com> |
---|---|
date | Thu, 26 Dec 2019 21:54:10 -0800 |
parents | d5198c7ec54d |
children | 397c178c5b98 |
comparison
equal
deleted
inserted
replaced
7:9df9ff8cecde | 8:05363e803272 |
---|---|
64 output_fp.write(ws.getvalue()) | 64 output_fp.write(ws.getvalue()) |
65 | 65 |
66 # M a i n P r o g r a m | 66 # M a i n P r o g r a m |
67 | 67 |
68 # Parse arguments | 68 # Parse arguments |
69 parser = argparse.ArgumentParser(description='Make straight quotes curly.', prog=MYNAME) | 69 parser = argparse.ArgumentParser( |
70 description='Make straight quotes curly.', prog=MYNAME) | |
70 group = parser.add_mutually_exclusive_group() | 71 group = parser.add_mutually_exclusive_group() |
71 group.add_argument("--flowed", action="store_true", help="Input is flowed text.") | 72 group.add_argument("--flowed", action="store_true", help="Input is flowed text.") |
72 group.add_argument("--html", action="store_true", help="Input is HTML.") | 73 group.add_argument("--html", action="store_true", help="Input is HTML.") |
73 group.add_argument("--uncurl", action="store_true", help="Uncurl quotes instead of curling them.") | 74 group.add_argument("--uncurl", action="store_true", help="Uncurl quotes instead of curling them.") |
74 parser.add_argument("--force", action="store_true", help="Force all quotes to straight ones first.") | 75 parser.add_argument("--force", action="store_true", help="Force all quotes to straight ones first.") |
75 parser.add_argument("--icoding", default="UTF-8", help="Input encoding.") | 76 parser.add_argument("--icoding", default="UTF-8", help="Input encoding (default UTF-8).") |
76 parser.add_argument("--inplace", action="store_true", help="Edit file in-place.") | 77 parser.add_argument("--inplace", action="store_true", help="Edit file in-place.") |
77 parser.add_argument("--ocoding", default="UTF-8", help="Output encoding.") | 78 parser.add_argument("--ocoding", default="UTF-8", help="Output encoding (default UTF-8).") |
78 parser.add_argument("input", nargs="?", help="Input file.") | 79 parser.add_argument("input", nargs="?", help="Input file.") |
79 parser.add_argument("output", nargs="?", help="Output file.") | 80 parser.add_argument("output", nargs="?", help="Output file.") |
80 try: | 81 try: |
81 args = parser.parse_args() | 82 args = parser.parse_args() |
82 except SystemExit: | 83 except SystemExit: |
88 codec = codecs.lookup(args.ocoding) | 89 codec = codecs.lookup(args.ocoding) |
89 except LookupError as e: | 90 except LookupError as e: |
90 sys.stderr.write("{0}: {1!s}\n".format(MYNAME, e)) | 91 sys.stderr.write("{0}: {1!s}\n".format(MYNAME, e)) |
91 sys.exit(2) | 92 sys.exit(2) |
92 if not CODECS_TO_NAME.get(codec, "").startswith("UTF-"): | 93 if not CODECS_TO_NAME.get(codec, "").startswith("UTF-"): |
93 sys.stderr.write("{0}: {1!s} output coding does not support Unicode\n".format(MYNAME, args.ocoding)) | 94 sys.stderr.write("{0}: {1!r} output coding does not support Unicode\n".format(MYNAME, args.ocoding)) |
94 sys.exit(1) | 95 sys.exit(1) |
95 del codec | 96 del codec |
96 | 97 |
97 # Get streams | 98 # Get streams |
98 try: | 99 try: |