use Psy\Command\ListCommand\TraitEnumerator;
use Psy\Command\ListCommand\VariableEnumerator;
use Psy\Exception\RuntimeException;
+use Psy\Input\FilterOptions;
use Psy\VarDumper\Presenter;
use Psy\VarDumper\PresenterAware;
use Symfony\Component\Console\Formatter\OutputFormatter;
*/
protected function configure()
{
+ list($grep, $insensitive, $invert) = FilterOptions::getOptions();
+
$this
->setName('ls')
->setAliases(array('list', 'dir'))
new InputOption('properties', 'p', InputOption::VALUE_NONE, 'Display class or object properties (public properties by default).'),
new InputOption('methods', 'm', InputOption::VALUE_NONE, 'Display class or object methods (public methods by default).'),
- new InputOption('grep', 'G', InputOption::VALUE_REQUIRED, 'Limit to items matching the given pattern (string or regex).'),
- new InputOption('insensitive', 'i', InputOption::VALUE_NONE, 'Case-insensitive search (requires --grep).'),
- new InputOption('invert', 'v', InputOption::VALUE_NONE, 'Inverted search (requires --grep).'),
+ $grep,
+ $insensitive,
+ $invert,
new InputOption('globals', 'g', InputOption::VALUE_NONE, 'Include global variables.'),
new InputOption('internal', 'n', InputOption::VALUE_NONE, 'Limit to internal functions and classes.'),
$reflector = null;
}
- // TODO: something cleaner than this :-/
+ // @todo something cleaner than this :-/
if ($input->getOption('long')) {
$output->startPaging();
}
*/
private function validateInput(InputInterface $input)
{
- // grep, invert and insensitive
- if (!$input->getOption('grep')) {
- foreach (array('invert', 'insensitive') as $option) {
- if ($input->getOption($option)) {
- throw new RuntimeException('--' . $option . ' does not make sense without --grep');
- }
- }
- }
-
if (!$input->getArgument('target')) {
// if no target is passed, there can be no properties or methods
foreach (array('properties', 'methods', 'no-inherit') as $option) {