diff options
author | Aldo Cortesi <aldo@corte.si> | 2017-12-20 09:09:40 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@corte.si> | 2017-12-20 09:09:40 +1300 |
commit | d7ee5d8f85044c93f5982756f49be8315d148e4c (patch) | |
tree | a7711babc31a37636de136d44ef6f359d9a00cc0 /mitmproxy/types.py | |
parent | 3341edc9fa8e70306e91cf911e4b2b19ef60ba84 (diff) | |
download | mitmproxy-d7ee5d8f85044c93f5982756f49be8315d148e4c.tar.gz mitmproxy-d7ee5d8f85044c93f5982756f49be8315d148e4c.tar.bz2 mitmproxy-d7ee5d8f85044c93f5982756f49be8315d148e4c.zip |
commander: palette entries, highlight errors
- Add palette entries specific to commander
- Highlight errors
- Introduce an Unknown type to keep track of extra unknown arguments to
commands
Diffstat (limited to 'mitmproxy/types.py')
-rw-r--r-- | mitmproxy/types.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/mitmproxy/types.py b/mitmproxy/types.py index bdbd3924..8ae8b309 100644 --- a/mitmproxy/types.py +++ b/mitmproxy/types.py @@ -18,6 +18,10 @@ class Arg(str): pass +class Unknown(str): + pass + + class CutSpec(typing.Sequence[str]): pass @@ -116,6 +120,20 @@ class _StrType(_BaseType): return isinstance(val, str) +class _UnknownType(_BaseType): + typ = Unknown + display = "unknown" + + def completion(self, manager: _CommandBase, t: type, s: str) -> typing.Sequence[str]: + return [] + + def parse(self, manager: _CommandBase, t: type, s: str) -> str: + return s + + def is_valid(self, manager: _CommandBase, typ: typing.Any, val: typing.Any) -> bool: + return False + + class _IntType(_BaseType): typ = int display = "int" |