simplified method

This commit is contained in:
Daniil Fajnberg 2022-02-13 20:58:36 +01:00
parent b6aed727e9
commit 05d51eface

View File

@ -142,16 +142,12 @@ class ControlSession:
async def _parse_command(self, msg: str) -> None:
try:
args, argv = self._parser.parse_known_args(msg.split(' '))
args = self._parser.parse_args(msg.split(' '))
except ArgumentError as e:
self._writer.write(str(e).encode())
return
except HelpRequested:
return
if argv:
log.debug("%s sent unknown arguments: %s", self._client_class_name, msg)
self._writer.write(b"Invalid command!")
return
await self._execute_command(args)
async def listen(self) -> None: