mirror of
https://github.com/vee1e/mitmproxy.git
synced 2026-09-01 18:27:18 +00:00
Excess changes were canceled
This commit is contained in:
parent
1c3c39cadf
commit
c0ed80e02b
5 changed files with 10 additions and 23 deletions
|
|
@ -221,7 +221,7 @@ class CommandManager(mitmproxy.types._CommandBase):
|
|||
"""
|
||||
Parse a possibly partial command. Return a sequence of ParseResults and a sequence of remainder type help items.
|
||||
"""
|
||||
parts: typing.List[str] = [t.value for t in lexer.get_tokens(cmdstr)]
|
||||
parts: typing.List[str] = lexer.get_tokens(cmdstr)
|
||||
if not parts:
|
||||
parts = [""]
|
||||
elif parts[-1].isspace():
|
||||
|
|
@ -305,7 +305,6 @@ class CommandManager(mitmproxy.types._CommandBase):
|
|||
Execute a command string. May raise CommandError.
|
||||
"""
|
||||
lex = lexer.create_lexer(cmdstr, self.oneword_commands)
|
||||
self.command_parser.async_exec = False
|
||||
parsed_cmd = self.command_parser.parse(lexer=lex)
|
||||
return parsed_cmd
|
||||
|
||||
|
|
|
|||
|
|
@ -62,11 +62,8 @@ def create_lexer(cmdstr: str, oneword_commands: typing.Sequence[str]) -> lex.Lex
|
|||
return command_lexer.lexer
|
||||
|
||||
|
||||
def get_tokens(cmdstr: str, state="interactive",
|
||||
oneword_commands=None) -> typing.List[lex.LexToken]:
|
||||
if oneword_commands is None:
|
||||
oneword_commands = []
|
||||
lexer = create_lexer(cmdstr, oneword_commands)
|
||||
def get_tokens(cmdstr: str, state="interactive") -> typing.List[lex.LexToken]:
|
||||
lexer = create_lexer(cmdstr, [])
|
||||
# Switching to the other state
|
||||
lexer.begin(state)
|
||||
return list(lexer)
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ class CommandLanguageParser:
|
|||
errorlog=yacc.NullLogger(), **kwargs)
|
||||
|
||||
def parse(self, lexer: lex.Lexer,
|
||||
async_exec=False, **kwargs) -> typing.Any:
|
||||
async_exec: bool=False, **kwargs) -> typing.Any:
|
||||
self.async_exec = async_exec
|
||||
self.parser.parse(lexer=lexer, **kwargs)
|
||||
self._reset_internals()
|
||||
|
|
|
|||
|
|
@ -577,16 +577,12 @@ class ConsoleAddon:
|
|||
Edit the currently focused key binding.
|
||||
"""
|
||||
b = self._keyfocus()
|
||||
print(f"""console.command [ console.key.bind
|
||||
[{" ".join(b.contexts)}]
|
||||
{b.key}
|
||||
"{b.command}" ]""")
|
||||
# self.console_command(
|
||||
# "console.key.bind",
|
||||
# ",".join(b.contexts),
|
||||
# b.key,
|
||||
# b.command,
|
||||
# )
|
||||
self.console_command(
|
||||
"console.key.bind",
|
||||
",".join(b.contexts),
|
||||
b.key,
|
||||
b.command,
|
||||
)
|
||||
|
||||
def running(self):
|
||||
self.started = True
|
||||
|
|
|
|||
|
|
@ -155,11 +155,6 @@ class Keymap:
|
|||
return self.executor(b.command)
|
||||
return key
|
||||
|
||||
def _get_braced_command(self, command):
|
||||
tokens = lexer.get_tokens(command, self.oneword_commands)
|
||||
|
||||
|
||||
|
||||
|
||||
keyAttrs = {
|
||||
"key": lambda x: isinstance(x, str),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue