nategood/commando — pull request #13 by stanlemon (2013-09-20 14:57:19+00:00)
Title: Allow for callable to require()

This change would allow for you to pass a callable into the require method and have it be evaluated when determining if the option is required. An example of why this might be used can be seen here:

```php
option('n')
->describedAs('Full Name');

$cmd->option('f')
->describedAs('First Name')
->require(function() use ($cmd){
return $cmd->getOption('n')->getValue() == null;
});

$cmd->option('l')
->describedAs('Last Name')
->require(function() use ($cmd){
return $cmd->getOption('n')->getValue() == null;
});

print (is_null($cmd['n']) ? $cmd['f'] . ' ' . $cmd['l'] : $cmd['n']) . PHP_EOL;
```

I've been working around this at work and thought it might be worth seeing if the use case merited an upstream change.

We have a number of scripts that use commando and take either a host of configuration options or a configuration file that supplies them. In the event of the configuration file all of the required configuration options become required. We wind up doing a lot of this to work around it...

```php
if ($cmd['n'] == null & $cmd['f'] == null) throw new \Exception("Missing requirement!");
```