cordoval/gush — pull request #118 by dantleech (2014-01-16 23:27:56+00:00)
Title: [POC] Added Event Subscriber

This PR adds an event dispatcher to the application and adds some custom events.

The idea is to decorate commands with listeners rather than throwing everything into the base command:

````
public function configure()
{
$this->addSubscriber(new TableSubscriber()); // in this PR
$this->addSubscriber(new GitHubSubscriber()); // conceptual - we would do this in a base command
}
````

These subscribers then subscriber to events like:

````

class GitHubSubscriber extends EventSubscriber
{
//...

public function decorateDefinition($event)
{
$command = $event->getCommand();
$commnad->addOption('dry-run', null, // ...);
$command->addOption('repo', 'r', // ...);
$command->addOption('org, 'o', // ...);
}

public function validate($event)
{
$input = $event->getInput();
// validate the input
}
}
````

I also found out that `Helper` classes can implement a `InputAwareInterface` which allows helpers to access the input. So in this PR I make the `TableHelper` work automatically with the options provided by the `TableSubscriber`.

I am thinking that we could do this with alot of cross-cutting concerns..