diff options
author | Henrique <typoon@gmail.com> | 2019-11-27 08:13:19 -0500 |
---|---|---|
committer | Henrique <typoon@gmail.com> | 2019-11-27 08:13:19 -0500 |
commit | 863d2fbcb20b3f94df2ef2cf2478e86a736b7b65 (patch) | |
tree | 945e191b5815c1f98ad429cc66ed789ae6e473b2 /mitmproxy/tools | |
parent | 09c0162e8d1ee1480945725762557b8c8f02c2f2 (diff) | |
parent | 819d5e631757f33a751eab8491b39eaacdb0c0c9 (diff) | |
download | mitmproxy-863d2fbcb20b3f94df2ef2cf2478e86a736b7b65.tar.gz mitmproxy-863d2fbcb20b3f94df2ef2cf2478e86a736b7b65.tar.bz2 mitmproxy-863d2fbcb20b3f94df2ef2cf2478e86a736b7b65.zip |
Merge branch 'command-history-file' of github.com:typoon/mitmproxy into command-history-file
Diffstat (limited to 'mitmproxy/tools')
-rw-r--r-- | mitmproxy/tools/console/commander/commander.py | 13 | ||||
-rw-r--r-- | mitmproxy/tools/console/statusbar.py | 7 |
2 files changed, 8 insertions, 12 deletions
diff --git a/mitmproxy/tools/console/commander/commander.py b/mitmproxy/tools/console/commander/commander.py index 0f45aa1f..0feae28e 100644 --- a/mitmproxy/tools/console/commander/commander.py +++ b/mitmproxy/tools/console/commander/commander.py @@ -9,8 +9,6 @@ import mitmproxy.flow import mitmproxy.master import mitmproxy.types -from mitmproxy import command_lexer - class Completer: @abc.abstractmethod @@ -200,7 +198,7 @@ class CommandEdit(urwid.WidgetWrap): self.cbuf.backspace() if self.cbuf.text == '': self.active_filter = False - self.master.commands.execute("command_history.filter ''") + self.master.commands.call("commands.history.filter", "") self.filter_str = '' elif key == "left" or key == "ctrl b": self.cbuf.left() @@ -210,20 +208,19 @@ class CommandEdit(urwid.WidgetWrap): if self.active_filter is False: self.active_filter = True self.filter_str = self.cbuf.text - _cmd = command_lexer.quote(self.cbuf.text) - self.master.commands.execute("command_history.filter %s" % _cmd) - cmd = self.master.commands.execute("command_history.prev") + self.master.commands.call("commands.history.filter", self.cbuf.text) + cmd = self.master.commands.execute("commands.history.prev") self.cbuf = CommandBuffer(self.master, cmd) elif key == "down" or key == "ctrl n": prev_cmd = self.cbuf.text - cmd = self.master.commands.execute("command_history.next") + cmd = self.master.commands.execute("commands.history.next") if cmd == '': if prev_cmd == self.filter_str: self.cbuf = CommandBuffer(self.master, prev_cmd) else: self.active_filter = False - self.master.commands.execute("command_history.filter ''") + self.master.commands.call("commands.history.filter", "") self.filter_str = '' self.cbuf = CommandBuffer(self.master, '') else: diff --git a/mitmproxy/tools/console/statusbar.py b/mitmproxy/tools/console/statusbar.py index 39141b97..43b81d22 100644 --- a/mitmproxy/tools/console/statusbar.py +++ b/mitmproxy/tools/console/statusbar.py @@ -132,7 +132,6 @@ class ActionBar(urwid.WidgetWrap): def keypress(self, size, k): if self.prompting: if k == "esc": - self.master.commands.execute('command_history.cancel') self.prompt_done() elif self.onekey: if k == "enter": @@ -140,9 +139,9 @@ class ActionBar(urwid.WidgetWrap): elif k in self.onekey: self.prompt_execute(k) elif k == "enter": - cmd = command_lexer.quote(self._w.cbuf.text) - self.master.commands.execute(f"command_history.add {cmd}") - self.prompt_execute(self._w.get_edit_text()) + text = self._w.get_edit_text() + self.prompt_execute(text) + self.master.commands.call("commands.history.add", text) else: if common.is_keypress(k): self._w.keypress(size, k) |