diff options
author | Aldo Cortesi <aldo@corte.si> | 2017-06-14 09:21:37 +1200 |
---|---|---|
committer | Aldo Cortesi <aldo@corte.si> | 2017-06-14 09:21:37 +1200 |
commit | e5f79abb4f2d8af73e99d3dccfb5875c6ef4075e (patch) | |
tree | 717d6b1b962109310bc92469e1a934e7754a806a | |
parent | 254fe34d4ca972a3488433d0bb0a2a58492852c2 (diff) | |
download | mitmproxy-e5f79abb4f2d8af73e99d3dccfb5875c6ef4075e.tar.gz mitmproxy-e5f79abb4f2d8af73e99d3dccfb5875c6ef4075e.tar.bz2 mitmproxy-e5f79abb4f2d8af73e99d3dccfb5875c6ef4075e.zip |
console: add console.key.execute.focus, bind to x
-rw-r--r-- | mitmproxy/tools/console/consoleaddons.py | 10 | ||||
-rw-r--r-- | mitmproxy/tools/console/defaultkeys.py | 8 |
2 files changed, 16 insertions, 2 deletions
diff --git a/mitmproxy/tools/console/consoleaddons.py b/mitmproxy/tools/console/consoleaddons.py index 4a687ff5..2a18fbb3 100644 --- a/mitmproxy/tools/console/consoleaddons.py +++ b/mitmproxy/tools/console/consoleaddons.py @@ -86,7 +86,7 @@ class ConsoleAddon: """ self.master.window.switch() - @command.command("console.options.reset.current") + @command.command("console.options.reset.focus") def options_reset_current(self) -> None: """ Reset the current option in the options editor. @@ -469,6 +469,14 @@ class ConsoleAddon: except ValueError as v: raise exceptions.CommandError(v) + @command.command("console.key.execute.focus") + def key_execute_focus(self) -> None: + """ + Execute the currently focused key binding. + """ + b = self._keyfocus() + self.console_command(b.command) + def running(self): self.started = True diff --git a/mitmproxy/tools/console/defaultkeys.py b/mitmproxy/tools/console/defaultkeys.py index 7edf0fd8..426dd10a 100644 --- a/mitmproxy/tools/console/defaultkeys.py +++ b/mitmproxy/tools/console/defaultkeys.py @@ -128,7 +128,7 @@ def map(km): km.add("L", "console.command options.load ", ["options"], "Load from file") km.add("S", "console.command options.save ", ["options"], "Save to file") km.add("D", "options.reset", ["options"], "Reset all options") - km.add("d", "console.options.reset.current", ["options"], "Reset this option") + km.add("d", "console.options.reset.focus", ["options"], "Reset this option") km.add("a", "console.grideditor.add", ["grideditor"], "Add a row after cursor") km.add("A", "console.grideditor.insert", ["grideditor"], "Insert a row before cursor") @@ -164,3 +164,9 @@ def map(km): ["keybindings"], "Unbind the currently focused key binding" ) + km.add( + "x", + "console.key.execute.focus", + ["keybindings"], + "Execute the currently focused key binding" + ) |