aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2017-06-11 13:28:31 +1200
committerAldo Cortesi <aldo@nullcube.com>2017-06-11 13:28:31 +1200
commit816a51b6c8fd1da99b45831429d373d836082eef (patch)
treefc363bc937680b8cbeb1de8f19852143e835988f
parentecce260542d66cf942ee77193c3c3104614c40e9 (diff)
downloadmitmproxy-816a51b6c8fd1da99b45831429d373d836082eef.tar.gz
mitmproxy-816a51b6c8fd1da99b45831429d373d836082eef.tar.bz2
mitmproxy-816a51b6c8fd1da99b45831429d373d836082eef.zip
console: help - remove hardcoded help everywhere
-rw-r--r--mitmproxy/tools/console/commands.py18
-rw-r--r--mitmproxy/tools/console/flowlist.py42
-rw-r--r--mitmproxy/tools/console/flowview.py76
-rw-r--r--mitmproxy/tools/console/help.py32
-rw-r--r--mitmproxy/tools/console/options.py22
-rw-r--r--mitmproxy/tools/console/statusbar.py16
-rw-r--r--mitmproxy/tools/console/window.py2
7 files changed, 3 insertions, 205 deletions
diff --git a/mitmproxy/tools/console/commands.py b/mitmproxy/tools/console/commands.py
index 5ab55e48..1ece5b63 100644
--- a/mitmproxy/tools/console/commands.py
+++ b/mitmproxy/tools/console/commands.py
@@ -8,24 +8,6 @@ from mitmproxy.tools.console import signals
HELP_HEIGHT = 5
-footer = [
- ('heading_key', "enter"), ":edit ",
- ('heading_key', "?"), ":help ",
-]
-
-
-def _mkhelp():
- text = []
- keys = [
- ("enter", "execute command"),
- ]
- text.extend(common.format_keyvals(keys, key="key", val="text", indent=4))
- return text
-
-
-help_context = _mkhelp()
-
-
def fcol(s, width, attr):
s = str(s)
return (
diff --git a/mitmproxy/tools/console/flowlist.py b/mitmproxy/tools/console/flowlist.py
index e2d9a571..d2990813 100644
--- a/mitmproxy/tools/console/flowlist.py
+++ b/mitmproxy/tools/console/flowlist.py
@@ -5,48 +5,6 @@ from mitmproxy.tools.console import layoutwidget
import mitmproxy.tools.console.master # noqa
-def _mkhelp():
- text = []
- keys = [
- ("A", "accept all intercepted flows"),
- ("a", "accept this intercepted flow"),
- ("b", "save request/response body"),
- ("C", "export flow to clipboard"),
- ("d", "delete flow"),
- ("D", "duplicate flow"),
- ("e", "toggle eventlog"),
- ("E", "export flow to file"),
- ("f", "filter view"),
- ("F", "toggle follow flow list"),
- ("L", "load saved flows"),
- ("m", "toggle flow mark"),
- ("M", "toggle marked flow view"),
- ("n", "create a new request"),
- ("o", "set flow order"),
- ("r", "replay request"),
- ("S", "server replay request/s"),
- ("U", "unmark all marked flows"),
- ("v", "reverse flow order"),
- ("V", "revert changes to request"),
- ("w", "save flows "),
- ("W", "stream flows to file"),
- ("X", "kill and delete flow, even if it's mid-intercept"),
- ("z", "clear flow list or eventlog"),
- ("Z", "clear unmarked flows"),
- ("tab", "tab between eventlog and flow list"),
- ("enter", "view flow"),
- ("|", "run script on this flow"),
- ]
- text.extend(common.format_keyvals(keys, key="key", val="text", indent=4))
- return text
-
-
-help_context = _mkhelp()
-
-footer = [
- ('heading_key', "?"), ":help ",
-]
-
class FlowItem(urwid.WidgetWrap):
diff --git a/mitmproxy/tools/console/flowview.py b/mitmproxy/tools/console/flowview.py
index 568c5e43..dc846b7a 100644
--- a/mitmproxy/tools/console/flowview.py
+++ b/mitmproxy/tools/console/flowview.py
@@ -20,82 +20,6 @@ class SearchError(Exception):
pass
-def _mkhelp():
- text = []
- keys = [
- ("A", "accept all intercepted flows"),
- ("a", "accept this intercepted flow"),
- ("b", "save request/response body"),
- ("C", "export flow to clipboard"),
- ("D", "duplicate flow"),
- ("d", "delete flow"),
- ("e", "edit request/response"),
- ("f", "load full body data"),
- ("m", "change body display mode for this entity\n(default mode can be changed in the options)"),
- (None,
- common.highlight_key("automatic", "a") +
- [("text", ": automatic detection")]
- ),
- (None,
- common.highlight_key("hex", "e") +
- [("text", ": Hex")]
- ),
- (None,
- common.highlight_key("html", "h") +
- [("text", ": HTML")]
- ),
- (None,
- common.highlight_key("image", "i") +
- [("text", ": Image")]
- ),
- (None,
- common.highlight_key("javascript", "j") +
- [("text", ": JavaScript")]
- ),
- (None,
- common.highlight_key("json", "s") +
- [("text", ": JSON")]
- ),
- (None,
- common.highlight_key("urlencoded", "u") +
- [("text", ": URL-encoded data")]
- ),
- (None,
- common.highlight_key("raw", "r") +
- [("text", ": raw data")]
- ),
- (None,
- common.highlight_key("xml", "x") +
- [("text", ": XML")]
- ),
- ("E", "export flow to file"),
- ("r", "replay request"),
- ("V", "revert changes to request"),
- ("v", "view body in external viewer"),
- ("w", "save all flows matching current view filter"),
- ("W", "save this flow"),
- ("x", "delete body"),
- ("z", "encode/decode a request/response"),
- ("tab", "next tab"),
- ("h, l", "previous tab, next tab"),
- ("space", "next flow"),
- ("|", "run script on this flow"),
- ("/", "search (case sensitive)"),
- ("n", "repeat search forward"),
- ("N", "repeat search backwards"),
- ]
- text.extend(common.format_keyvals(keys, key="key", val="text", indent=4))
- return text
-
-
-help_context = _mkhelp()
-
-footer = [
- ('heading_key', "?"), ":help ",
- ('heading_key', "q"), ":back ",
-]
-
-
class FlowViewHeader(urwid.WidgetWrap):
def __init__(
diff --git a/mitmproxy/tools/console/help.py b/mitmproxy/tools/console/help.py
index 60ed4ec9..edfae5f2 100644
--- a/mitmproxy/tools/console/help.py
+++ b/mitmproxy/tools/console/help.py
@@ -19,7 +19,6 @@ class HelpView(urwid.ListBox, layoutwidget.LayoutWidget):
keyctx = "help"
def __init__(self, help_context):
- self.help_context = help_context or []
urwid.ListBox.__init__(
self,
self.helptext()
@@ -27,37 +26,6 @@ class HelpView(urwid.ListBox, layoutwidget.LayoutWidget):
def helptext(self):
text = []
- text.append(urwid.Text([("head", "This view:\n")]))
- text.extend(self.help_context)
-
- text.append(urwid.Text([("head", "\n\nMovement:\n")]))
- keys = [
- ("j, k", "down, up"),
- ("h, l", "left, right (in some contexts)"),
- ("g, G", "go to beginning, end"),
- ("space", "page down"),
- ("pg up/down", "page up/down"),
- ("ctrl+b/ctrl+f", "page up/down"),
- ("arrows", "up, down, left, right"),
- ]
- text.extend(
- common.format_keyvals(
- keys,
- key="key",
- val="text",
- indent=4))
-
- text.append(urwid.Text([("head", "\n\nGlobal keys:\n")]))
- keys = [
- ("i", "set interception pattern"),
- ("O", "options"),
- ("q", "quit / return to previous page"),
- ("Q", "quit without confirm prompt"),
- ("R", "replay of requests/responses from file"),
- ]
- text.extend(
- common.format_keyvals(keys, key="key", val="text", indent=4)
- )
text.append(urwid.Text([("head", "\n\nFilter expressions:\n")]))
text.extend(common.format_keyvals(flowfilter.help, key="key", val="text", indent=4))
diff --git a/mitmproxy/tools/console/options.py b/mitmproxy/tools/console/options.py
index c364c308..54561134 100644
--- a/mitmproxy/tools/console/options.py
+++ b/mitmproxy/tools/console/options.py
@@ -21,28 +21,6 @@ def can_edit_inplace(opt):
return True
-footer = [
- ('heading_key', "enter"), ":edit ",
- ('heading_key', "?"), ":help ",
-]
-
-
-def _mkhelp():
- text = []
- keys = [
- ("enter", "edit option"),
- ("D", "reset all to defaults"),
- ("d", "reset this option to default"),
- ("l", "load options from file"),
- ("w", "save options to file"),
- ]
- text.extend(common.format_keyvals(keys, key="key", val="text", indent=4))
- return text
-
-
-help_context = _mkhelp()
-
-
def fcol(s, width, attr):
s = str(s)
return (
diff --git a/mitmproxy/tools/console/statusbar.py b/mitmproxy/tools/console/statusbar.py
index 7e471b90..a4308848 100644
--- a/mitmproxy/tools/console/statusbar.py
+++ b/mitmproxy/tools/console/statusbar.py
@@ -146,24 +146,18 @@ class StatusBar(urwid.WidgetWrap):
keyctx = ""
def __init__(
- self, master: "mitmproxy.tools.console.master.ConsoleMaster", helptext
+ self, master: "mitmproxy.tools.console.master.ConsoleMaster"
) -> None:
self.master = master
- self.helptext = helptext
self.ib = urwid.WidgetWrap(urwid.Text(""))
self.ab = ActionBar(self.master)
super().__init__(urwid.Pile([self.ib, self.ab]))
signals.update_settings.connect(self.sig_update)
signals.flowlist_change.connect(self.sig_update)
- signals.footer_help.connect(self.sig_footer_help)
master.options.changed.connect(self.sig_update)
master.view.focus.sig_change.connect(self.sig_update)
self.redraw()
- def sig_footer_help(self, sender, helptext):
- self.helptext = helptext
- self.redraw()
-
def sig_update(self, sender, updated=None):
self.redraw()
@@ -288,13 +282,7 @@ class StatusBar(urwid.WidgetWrap):
t.extend(self.get_status())
status = urwid.AttrWrap(urwid.Columns([
urwid.Text(t),
- urwid.Text(
- [
- self.helptext,
- boundaddr
- ],
- align="right"
- ),
+ urwid.Text(boundaddr, align="right"),
]), "heading")
self.ib._w = status
diff --git a/mitmproxy/tools/console/window.py b/mitmproxy/tools/console/window.py
index d021bf35..6a6a499c 100644
--- a/mitmproxy/tools/console/window.py
+++ b/mitmproxy/tools/console/window.py
@@ -94,7 +94,7 @@ class WindowStack:
class Window(urwid.Frame):
def __init__(self, master):
- self.statusbar = statusbar.StatusBar(master, "")
+ self.statusbar = statusbar.StatusBar(master)
super().__init__(
None,
header = None,