aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mitmproxy/addonmanager.py2
-rw-r--r--mitmproxy/tools/console/master.py7
-rw-r--r--mitmproxy/tools/console/window.py13
-rw-r--r--test/mitmproxy/addons/test_core.py2
4 files changed, 8 insertions, 16 deletions
diff --git a/mitmproxy/addonmanager.py b/mitmproxy/addonmanager.py
index ea23b6ff..9779a31a 100644
--- a/mitmproxy/addonmanager.py
+++ b/mitmproxy/addonmanager.py
@@ -56,7 +56,7 @@ def safecall():
try:
with contextlib.redirect_stdout(stdout_replacement):
yield
- except exceptions.AddonHalt:
+ except (exceptions.AddonHalt, exceptions.OptionsError):
raise
except Exception as e:
etype, value, tb = sys.exc_info()
diff --git a/mitmproxy/tools/console/master.py b/mitmproxy/tools/console/master.py
index d65562de..74413f4c 100644
--- a/mitmproxy/tools/console/master.py
+++ b/mitmproxy/tools/console/master.py
@@ -83,9 +83,9 @@ class ConsoleCommands:
def __init__(self, master):
self.master = master
- def command(self) -> None:
+ def command(self, partial: str) -> None:
"""Prompt for a command."""
- signals.status_prompt_command.send()
+ signals.status_prompt_command.send(partial=partial)
def view_commands(self) -> None:
"""View the commands list."""
@@ -120,12 +120,13 @@ class ConsoleCommands:
def default_keymap(km):
- km.add(":", "console.command")
+ km.add(":", "console.command ''")
km.add("?", "console.view.help")
km.add("C", "console.view.commands")
km.add("O", "console.view.options")
km.add("Q", "console.exit")
km.add("q", "console.view.pop")
+ km.add("i", "console.command 'set intercept='")
class ConsoleMaster(master.Master):
diff --git a/mitmproxy/tools/console/window.py b/mitmproxy/tools/console/window.py
index 0e41fb2a..b7fc8efa 100644
--- a/mitmproxy/tools/console/window.py
+++ b/mitmproxy/tools/console/window.py
@@ -82,15 +82,4 @@ class Window(urwid.Frame):
def keypress(self, size, k):
k = super().keypress(size, k)
- k = self.master.keymap.handle("", k)
- if not k:
- return
- elif k == "i":
- signals.status_prompt.send(
- self,
- prompt = "Intercept filter",
- text = self.master.options.intercept,
- callback = self.master.options.setter("intercept")
- )
- else:
- return k
+ return self.master.keymap.handle("", k)
diff --git a/test/mitmproxy/addons/test_core.py b/test/mitmproxy/addons/test_core.py
index 99bf3f40..6ebf4ba9 100644
--- a/test/mitmproxy/addons/test_core.py
+++ b/test/mitmproxy/addons/test_core.py
@@ -7,6 +7,8 @@ import pytest
def test_set():
sa = core.Core()
with taddons.context() as tctx:
+ tctx.master.addons.add(sa)
+
assert not tctx.master.options.anticomp
tctx.command(sa.set, "anticomp")
assert tctx.master.options.anticomp