From af2417aef0275919703c450642fda6f84cd06895 Mon Sep 17 00:00:00 2001 From: Sebastian Muszynski Date: Sat, 2 Jun 2018 09:45:44 +0200 Subject: [PATCH] miiocli: Handle unknown commands (Closes: #327) (#329) --- miio/click_common.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/miio/click_common.py b/miio/click_common.py index 1de4c0f52..44f7190d1 100644 --- a/miio/click_common.py +++ b/miio/click_common.py @@ -218,6 +218,9 @@ def command_callback(self, command, device, *args, **kwargs): return command.call(device, *args, **kwargs) def get_command(self, ctx, cmd_name): + if cmd_name not in self.commands: + ctx.fail('Unknown command (%s)' % cmd_name) + cmd = self.commands[cmd_name] return self.commands[cmd_name].wrap(ctx, self.device_pass(partial( self.command_callback, cmd