Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

miiocli: Handle unknown commands (Closes: #327) #329

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions miio/click_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down