diff options
author | Aldo Cortesi <aldo@nullcube.com> | 2017-03-05 20:45:55 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@nullcube.com> | 2017-03-05 20:45:55 +1300 |
commit | 45d18ac8cba462eb4f4f73e3e63ea539b44c6f83 (patch) | |
tree | 825f665e4f1bc03f0e856ddd9ab5270177e461cc /mitmproxy/optmanager.py | |
parent | f15a6285613540e031b004b726799dd6edee5a27 (diff) | |
download | mitmproxy-45d18ac8cba462eb4f4f73e3e63ea539b44c6f83.tar.gz mitmproxy-45d18ac8cba462eb4f4f73e3e63ea539b44c6f83.tar.bz2 mitmproxy-45d18ac8cba462eb4f4f73e3e63ea539b44c6f83.zip |
Start unifying options and the command-line: ints
Moves all integer options apart from a few tricky ones like verbosity over to
auto generation. Also add a metavar argument to parser generation to support
this.
Diffstat (limited to 'mitmproxy/optmanager.py')
-rw-r--r-- | mitmproxy/optmanager.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/mitmproxy/optmanager.py b/mitmproxy/optmanager.py index 240e3642..c16e2999 100644 --- a/mitmproxy/optmanager.py +++ b/mitmproxy/optmanager.py @@ -312,7 +312,7 @@ class OptManager: options=options ) - def make_parser(self, parser, option): + def make_parser(self, parser, option, metavar=None): o = self._options[option] f = option.replace("_", "-") if o.typespec == bool: @@ -330,5 +330,14 @@ class OptManager: help=o.help ) parser.set_defaults(**{option: o.default}) + elif o.typespec == int: + parser.add_argument( + "--%s" % f, + action="store", + type=int, + dest=option, + help=o.help, + metavar=metavar + ) else: raise ValueError("Unsupported option type: %s", o.typespec) |