aboutsummaryrefslogtreecommitdiffstats
path: root/mitmproxy
diff options
context:
space:
mode:
authorMatthew Shao <me@matshao.com>2017-08-05 11:30:12 +0800
committerMatthew Shao <me@matshao.com>2017-08-05 11:30:12 +0800
commit43e5647cefadd762d1ab14b20ea4c655dd45854e (patch)
tree6f03cf61a169e5b8b43ffbb0076dbe9d19ce86ce /mitmproxy
parentcd222ff4f92c9018813f55a54694e76dba72aa6d (diff)
downloadmitmproxy-43e5647cefadd762d1ab14b20ea4c655dd45854e.tar.gz
mitmproxy-43e5647cefadd762d1ab14b20ea4c655dd45854e.tar.bz2
mitmproxy-43e5647cefadd762d1ab14b20ea4c655dd45854e.zip
Add console_focus_follow in view and eventlog addons.
Diffstat (limited to 'mitmproxy')
-rw-r--r--mitmproxy/addons/view.py7
-rw-r--r--mitmproxy/tools/console/consoleaddons.py56
-rw-r--r--mitmproxy/tools/console/eventlog.py6
3 files changed, 34 insertions, 35 deletions
diff --git a/mitmproxy/addons/view.py b/mitmproxy/addons/view.py
index b8bb42bb..8ae1f341 100644
--- a/mitmproxy/addons/view.py
+++ b/mitmproxy/addons/view.py
@@ -23,7 +23,6 @@ from mitmproxy import connections
from mitmproxy import ctx
from mitmproxy import io
from mitmproxy import http # noqa
-from mitmproxy.tools.console import consoleaddons
# The underlying sorted list implementation expects the sort key to be stable
# for the lifetime of the object. However, if we sort by size, for instance,
@@ -147,8 +146,6 @@ class View(collections.Sequence):
self.settings = Settings(self)
def load(self, loader):
-
- consoleaddons.common_options(loader)
loader.add_option(
"view_order", str, "time",
"Flow sort order.",
@@ -158,6 +155,10 @@ class View(collections.Sequence):
"view_order_reversed", bool, False,
"Reverse the sorting order."
)
+ loader.add_option(
+ "console_focus_follow", bool, False,
+ "Focus follows new flows."
+ )
def store_count(self):
return len(self._store)
diff --git a/mitmproxy/tools/console/consoleaddons.py b/mitmproxy/tools/console/consoleaddons.py
index 0a36018e..87542fd4 100644
--- a/mitmproxy/tools/console/consoleaddons.py
+++ b/mitmproxy/tools/console/consoleaddons.py
@@ -81,7 +81,32 @@ class ConsoleAddon:
self.started = False
def load(self, loader):
- common_options(loader)
+ loader.add_option(
+ "console_layout", str, "single",
+ "Console layout.",
+ choices=sorted(console_layouts),
+ )
+ loader.add_option(
+ "console_layout_headers", bool, True,
+ "Show layout comonent headers",
+ )
+ loader.add_option(
+ "console_focus_follow", bool, False,
+ "Focus follows new flows."
+ )
+ loader.add_option(
+ "console_palette", str, "solarized_dark",
+ "Color palette.",
+ choices=sorted(console_palettes),
+ )
+ loader.add_option(
+ "console_palette_transparent", bool, False,
+ "Set transparent background for palette."
+ )
+ loader.add_option(
+ "console_mouse", bool, True,
+ "Console mouse interaction."
+ )
@command.command("console.layout.options")
def layout_options(self) -> typing.Sequence[str]:
@@ -528,32 +553,3 @@ class ConsoleAddon:
signals.update_settings.send(self)
for f in flows:
signals.flow_change.send(self, flow=f)
-
-
-def common_options(loader):
- loader.add_option(
- "console_layout", str, "single",
- "Console layout.",
- choices=sorted(console_layouts),
- )
- loader.add_option(
- "console_layout_headers", bool, True,
- "Show layout comonent headers",
- )
- loader.add_option(
- "console_focus_follow", bool, False,
- "Focus follows new flows."
- )
- loader.add_option(
- "console_palette", str, "solarized_dark",
- "Color palette.",
- choices=sorted(console_palettes),
- )
- loader.add_option(
- "console_palette_transparent", bool, False,
- "Set transparent background for palette."
- )
- loader.add_option(
- "console_mouse", bool, True,
- "Console mouse interaction."
- )
diff --git a/mitmproxy/tools/console/eventlog.py b/mitmproxy/tools/console/eventlog.py
index d35e24c3..c3e5dd39 100644
--- a/mitmproxy/tools/console/eventlog.py
+++ b/mitmproxy/tools/console/eventlog.py
@@ -1,7 +1,6 @@
import urwid
from mitmproxy.tools.console import signals
from mitmproxy.tools.console import layoutwidget
-from mitmproxy.tools.console import consoleaddons
from mitmproxy import ctx
from mitmproxy import log
@@ -24,7 +23,10 @@ class EventLog(urwid.ListBox, layoutwidget.LayoutWidget):
signals.sig_clear_log.connect(self.sig_clear_log)
def load(self, loader):
- consoleaddons.common_options(loader)
+ loader.add_option(
+ "console_focus_follow", bool, False,
+ "Focus follows new flows."
+ )
def set_focus(self, index):
if 0 <= index < len(self.walker):