Added an execute() method to context to catch unhandled commands

This commit is contained in:
Christopher Vagnetoft
2016-11-19 14:18:53 +01:00
parent 7bfd8453e7
commit 43a6475192
3 changed files with 43 additions and 0 deletions

View File

@ -223,6 +223,12 @@ class Shell
}
return;
}
// Call 'execute' on the current context
if ($this->context->execute($command, ...$args)) {
return;
}
// Throw error if the command could not be found
throw new Exception\BadCommandException("Command {$command} not found");
}