Chromium Code Reviews| Index: src/caterpillar.py |
| diff --git a/src/caterpillar.py b/src/caterpillar.py |
| index 4a0a8b5c38e4e035c8b1953a6cd4babbfe734961..673750b621c8495c1811de3ce5f11e4da42b84c5 100755 |
| --- a/src/caterpillar.py |
| +++ b/src/caterpillar.py |
| @@ -706,6 +706,11 @@ class Formatter(logging.Formatter): |
| return style + super(Formatter, self).format(record) |
| +def unicode_arg(arg): |
| + """Converts a bytestring command-line argument into a Unicode string.""" |
| + return arg.decode(sys.stdin.encoding) |
| + |
| + |
| def main(): |
| """Executes the script and handles command line arguments.""" |
| # Set up parsers, then parse the command line arguments. |
| @@ -717,17 +722,19 @@ def main(): |
| parser_convert = subparsers.add_parser( |
| 'convert', help='Convert a Chrome App into a progressive web app.') |
| - parser_convert.add_argument('input', help='Chrome App input directory') |
| + parser_convert.add_argument('input', help='Chrome App input directory', |
| + type=unicode_arg) |
|
Matt Giuca
2016/01/29 02:46:25
Indent
Matthew Alger
2016/01/29 02:51:18
Done.
|
| parser_convert.add_argument( |
| - 'output', help='Progressive web app output directory') |
| + 'output', help='Progressive web app output directory', type=unicode_arg) |
| parser_convert.add_argument('-c', '--config', help='Configuration file', |
| - required=True, metavar='config') |
| + required=True, metavar='config', type=unicode_arg) |
| parser_convert.add_argument('-f', '--force', help='Force output overwrite', |
| action='store_true') |
| parser_config = subparsers.add_parser( |
| 'config', help='Print a default configuration file to stdout.') |
| - parser_config.add_argument('output', help='Output config file path') |
| + parser_config.add_argument('output', help='Output config file path', |
| + type=unicode_arg) |
| parser_config.add_argument('-i', '--interactive', |
| help='Whether to interactively generate the config file', |
| action='store_true') |