aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy/types.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@corte.si>2017-12-20 09:09:40 +1300
committerAldo Cortesi <aldo@corte.si>2017-12-20 09:09:40 +1300
commitd7ee5d8f85044c93f5982756f49be8315d148e4c (patch)
treea7711babc31a37636de136d44ef6f359d9a00cc0 /mitmproxy/types.py
parent3341edc9fa8e70306e91cf911e4b2b19ef60ba84 (diff)
downloadmitmproxy-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.py18
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"