From 1b6bc874b5b3f7d352e9b181c774ea044957a6e6 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sun, 19 Mar 2017 14:01:32 +1300 Subject: [PATCH] console options: "d" to reset this option to default --- mitmproxy/tools/console/options.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/mitmproxy/tools/console/options.py b/mitmproxy/tools/console/options.py index 65b903db..20f53f81 100644 --- a/mitmproxy/tools/console/options.py +++ b/mitmproxy/tools/console/options.py @@ -30,6 +30,7 @@ def _mkhelp(): keys = [ ("enter", "edit option"), ("D", "reset all to defaults"), + ("d", "reset this option to default"), ("w", "save options"), ] text.extend(common.format_keyvals(keys, key="key", val="text", indent=4)) @@ -193,7 +194,14 @@ class OptionsList(urwid.ListBox): elif key == "esc": self.walker.stop_editing() else: - if key == "g": + if key == "d": + foc, idx = self.get_focus() + setattr( + self.master.options, + foc.opt.name, + self.master.options.default(foc.opt.name) + ) + elif key == "g": self.set_focus(0) self.walker._modified() elif key == "G":