diff options
author | Aldo Cortesi <aldo@corte.si> | 2017-12-17 11:23:15 +1300 |
---|---|---|
committer | Aldo Cortesi <aldo@corte.si> | 2017-12-17 11:23:15 +1300 |
commit | a289db8d75dfc1afa5c45fbb419fdf113191ec2b (patch) | |
tree | 6ce3575e396b5d917d839435339e9bbc9f07fe91 /mitmproxy | |
parent | e549b63465253a8b4cdb17efbf130e20371aa3b0 (diff) | |
download | mitmproxy-a289db8d75dfc1afa5c45fbb419fdf113191ec2b.tar.gz mitmproxy-a289db8d75dfc1afa5c45fbb419fdf113191ec2b.tar.bz2 mitmproxy-a289db8d75dfc1afa5c45fbb419fdf113191ec2b.zip |
commands: minor refactoring and command renaming
Diffstat (limited to 'mitmproxy')
-rw-r--r-- | mitmproxy/command.py | 6 | ||||
-rw-r--r-- | mitmproxy/tools/console/consoleaddons.py | 10 | ||||
-rw-r--r-- | mitmproxy/tools/console/defaultkeys.py | 8 |
3 files changed, 12 insertions, 12 deletions
diff --git a/mitmproxy/command.py b/mitmproxy/command.py index 22c2376b..c86d9792 100644 --- a/mitmproxy/command.py +++ b/mitmproxy/command.py @@ -110,7 +110,7 @@ class Arg(str): pass -def typename(t: type, ret: bool) -> str: +def typename(t: type) -> str: """ Translates a type to an explanatory string. If ret is True, we're looking at a return type, else we're looking at a parameter type. @@ -153,13 +153,13 @@ class Command: self.returntype = sig.return_annotation def paramnames(self) -> typing.Sequence[str]: - v = [typename(i, False) for i in self.paramtypes] + v = [typename(i) for i in self.paramtypes] if self.has_positional: v[-1] = "*" + v[-1] return v def retname(self) -> str: - return typename(self.returntype, True) if self.returntype else "" + return typename(self.returntype) if self.returntype else "" def signature_help(self) -> str: params = " ".join(self.paramnames()) diff --git a/mitmproxy/tools/console/consoleaddons.py b/mitmproxy/tools/console/consoleaddons.py index 61e107f4..95100fbf 100644 --- a/mitmproxy/tools/console/consoleaddons.py +++ b/mitmproxy/tools/console/consoleaddons.py @@ -402,17 +402,17 @@ class ConsoleAddon: """ self._grideditor().cmd_delete() - @command.command("console.grideditor.readfile") - def grideditor_readfile(self, path: command.Path) -> None: + @command.command("console.grideditor.load") + def grideditor_load(self, path: command.Path) -> None: """ Read a file into the currrent cell. """ self._grideditor().cmd_read_file(path) - @command.command("console.grideditor.readfile_escaped") - def grideditor_readfile_escaped(self, path: command.Path) -> None: + @command.command("console.grideditor.load_escaped") + def grideditor_load_escaped(self, path: command.Path) -> None: """ - Read a file containing a Python-style escaped stringinto the + Read a file containing a Python-style escaped string into the currrent cell. """ self._grideditor().cmd_read_file_escaped(path) diff --git a/mitmproxy/tools/console/defaultkeys.py b/mitmproxy/tools/console/defaultkeys.py index 7920225b..69c6e49f 100644 --- a/mitmproxy/tools/console/defaultkeys.py +++ b/mitmproxy/tools/console/defaultkeys.py @@ -145,15 +145,15 @@ def map(km): km.add("d", "console.grideditor.delete", ["grideditor"], "Delete this row") km.add( "r", - "console.command console.grideditor.readfile", + "console.command console.grideditor.load", ["grideditor"], - "Read unescaped data from file" + "Read unescaped data into the current cell from file" ) km.add( "R", - "console.command console.grideditor.readfile_escaped", + "console.command console.grideditor.load_escaped", ["grideditor"], - "Read a Python-style escaped string from file" + "Load a Python-style escaped string into the current cell from file" ) km.add("e", "console.grideditor.editor", ["grideditor"], "Edit in external editor") |