mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-26 18:18:25 +00:00
core: set command can now take multiple values
These are joined together with spaces before execution. This is a big convenience boost on the command-prompt.
This commit is contained in:
parent
d95f28e6bf
commit
0fc24857e1
@ -10,13 +10,15 @@ from mitmproxy.net.http import status_codes
|
|||||||
|
|
||||||
class Core:
|
class Core:
|
||||||
@command.command("set")
|
@command.command("set")
|
||||||
def set(self, spec: str) -> None:
|
def set(self, *spec: typing.Sequence[str]) -> None:
|
||||||
"""
|
"""
|
||||||
Set an option of the form "key[=value]". When the value is omitted,
|
Set an option of the form "key[=value]". When the value is omitted,
|
||||||
booleans are set to true, strings and integers are set to None (if
|
booleans are set to true, strings and integers are set to None (if
|
||||||
permitted), and sequences are emptied. Boolean values can be true,
|
permitted), and sequences are emptied. Boolean values can be true,
|
||||||
false or toggle.
|
false or toggle. If multiple specs are passed, they are joined
|
||||||
|
into one separated by spaces.
|
||||||
"""
|
"""
|
||||||
|
spec = " ".join(spec)
|
||||||
try:
|
try:
|
||||||
ctx.options.set(spec)
|
ctx.options.set(spec)
|
||||||
except exceptions.OptionsError as e:
|
except exceptions.OptionsError as e:
|
||||||
|
@ -238,7 +238,7 @@ class ConsoleAddon:
|
|||||||
"""
|
"""
|
||||||
Prompt the user to edit a command with a (possilby empty) starting value.
|
Prompt the user to edit a command with a (possilby empty) starting value.
|
||||||
"""
|
"""
|
||||||
signals.status_prompt_command.send(partial=" ".join(partial) + " ") # type: ignore
|
signals.status_prompt_command.send(partial=" ".join(partial)) # type: ignore
|
||||||
|
|
||||||
@command.command("console.view.commands")
|
@command.command("console.view.commands")
|
||||||
def view_commands(self) -> None:
|
def view_commands(self) -> None:
|
||||||
|
Loading…
Reference in New Issue
Block a user