Gets the option parser instance and configures it.

@return \Cake\Console\ConsoleOptionParser
172637
public function getOptionParser()
    {
        $parser = parent::getOptionParser();
        $parser
            ->description(__d('eav', 'Select target table'))
            ->addOption('use', [
                'short' => 'u',
                'help' => __d('eav', 'The table alias name. e.g. "User.Users".'),
            ])
            ->addOption('bundle', [
                'short' => 'b',
                'help' => __d('eav', 'Indicates the column belongs to a bundle name within the table.'),
                'default' => null,
            ]);

        return $parser;
    }
88349
public function getOptionParser() {
		$subcommandParser = [
			'options' => [
				/*
				'dry-run'=> array(
					'short' => 'd',
					'help' => 'Dry run the update, no jobs will actually be added.',
					'boolean' => true
				),
				*/
			],
		];
		$subcommandParserFull = $subcommandParser;
		$subcommandParserFull['options']['group'] = [
			'short' => 'g',
			'help' => 'Group (comma separated list possible)',
			'default' => null,
		];
		$subcommandParserFull['options']['type'] = [
			'short' => 't',
			'help' => 'Type (comma separated list possible)',
			'default' => null,
		];

		$rerunParser = $subcommandParser;
		$rerunParser['arguments'] = [
			'type' => [
				'help' => 'Job type. You need to specify one.',
				'required' => true,
			],
			'reference' => [
				'help' => 'Reference.',
				'required' => false,
			],
		];

		return parent::getOptionParser()
			->setDescription($this->_getDescription())
			->addSubcommand('clean', [
				'help' => 'Remove old jobs (cleanup)',
				'parser' => $subcommandParser,
			])
			->addSubcommand('add', [
				'help' => 'Add Job',
				'parser' => $subcommandParser,
			])
			->addSubcommand('stats', [
				'help' => 'Stats',
				'parser' => $subcommandParserFull,
			])
			->addSubcommand('settings', [
				'help' => 'Settings',
				'parser' => $subcommandParserFull,
			])
			->addSubcommand('reset', [
				'help' => 'Manually reset (failed) jobs for re-run.',
				'parser' => $subcommandParserFull,
			])
			->addSubcommand('rerun', [
				'help' => 'Manually rerun (successfully) run job.',
				'parser' => $rerunParser,
			])
			->addSubcommand('hard_reset', [
				'help' => 'Hard reset queue (remove all jobs)',
				'parser' => $subcommandParserFull,
			])
			->addSubcommand('end', [
				'help' => 'Manually end a worker.',
				'parser' => $subcommandParserFull,
			])
			->addSubcommand('kill', [
				'help' => 'Manually kill a worker.',
				'parser' => $subcommandParserFull,
			])
			->addSubcommand('runworker', [
				'help' => 'Run Worker',
				'parser' => $subcommandParserFull,
			]);
	}
209239
public function getOptions() {
		$reflection = new ReflectionObject($this);
		$methods    = $reflection->getMethods(ReflectionMethod::IS_PUBLIC);
		
		$options = [];
		
		foreach ($methods as $method) {
			if ($method->getNumberOfRequiredParameters() > 0) {
				continue;
			}
			
			$name = $method->name;
			
			if (isset($name[3]) && $name !== 'getOptions' && substr($name, 0, 3) === 'get') {
				$optionName = lcfirst(substr($name, 3));
				$options[$optionName] = $method->invoke($this);
			}
		}
		
		return $options;
	}
1007801
public function getOptionParser()
    {
        $parser = parent::getOptionParser();
        $parser
            ->description('Table schema manipulator.')
            ->addSubcommand('schema', [
                'help' => 'Allows to add or drop virtual columns to tables.',
                'parser' => $this->Schema->getOptionParser(),
            ])
            ->addSubcommand('info', [
                'help' => 'Display information of virtual columns attached to tables.',
                'parser' => $this->Info->getOptionParser(),
            ]);

        return $parser;
    }
542187
private function getParser()
    {
        if (null === $this->parser) {
            $this->parser = new Parser;
            $this->fixUniqueHeaders();
            $this->parser->setText($this->toString());
        }
        return $this->parser;
    }
874238
public function getOptionsForConsole()
    {
        $builder = '';

        foreach ($this->options as $option => $value) {
            $builder .= '--' . $option;

            if ($value) {
                $builder .= '=' . $value;
            }

            $builder .= ' ';
        }

        return $builder;
    }
1168119
public function getOptionParser()
    {
        $parser = parent::getOptionParser();
        $parser
            ->description('Database maintenance commands.')
            ->addSubcommand('export', [
                'help' => 'Export database to portable format.',
                'parser' => $this->DatabaseExport->getOptionParser(),
            ])
            ->addSubcommand('tables', [
                'help' => 'List all database tables.',
            ])
            ->addSubcommand('connection', [
                'help' => 'Show connection settings.',
            ]);

        return $parser;
    }
1002442
public function getOptionParser() {
		$parser = parent::getOptionParser();
		$parser->addArgument('name(s)', array(
			'required' => true,
			'help' => 'Enter one or more cache/view names separated by comma or "all"' .
			"\n<comment>(choises: " . implode(',', array_merge(Cache::configured(), array('all'))) . ")</comment>"
		));
		$parser->addOption('views', array(
			'boolean' => true,
			'help' => 'If set views files will be deleted' .
			"\n<comment>(choises: " . implode(',', array('view_file_name*', 'all')) . ")</comment>"
		));
		return $parser->description('Clear cache');
	}
1132000
public function getParser()
    {
        if (!$this->parser) {
            $this->setParser(Injector::inst()->get('SilverStripe\\View\\SSTemplateParser'));
        }
        return $this->parser;
    }
148595
public function getParser()
    {
        if (!isset($this->parser)) {
            $this->parser = new Parser($this);
        }
        return $this->parser;
    }
619478
public static function parser()
	{
		if ( ! empty(static::$_parser))
		{
			return static::$_parser;
		}

		$options = array(
			// TODO: set 'logger' with Monolog instance.
			'cache'   => \Config::get('parser.View_Mustache.environment.cache_dir', APPPATH.'cache'.DS.'mustache'.DS),
			'charset' => \Config::get('parser.View_Mustache.environment.charset', 'UTF-8'),
		);

		if ($partials = \Config::get('parser.View_Mustache.environment.partials', array())) {
			$options['partials'] = $partials;
		}

		if ($helpers = \Config::get('parser.View_Mustache.environment.helpers', array())) {
			$options['helpers'] = $helpers;
		}

		static::$_parser = new Mustache_Engine($options);

		return static::$_parser;
	}
956565
public function getOptionParser() {
        $requireProject = [
            'arguments' => [
                'project' => ['help' => 'Project name (folder)', 'required' => true]
            ]
        ];

        return parent::getOptionParser()
            ->addSubCommand('all', [
                'help' => 'Same as "start" + "create" + "unseal" + "mounts"'
            ])
            ->addSubCommand('start', [
                'help' => 'Start vault'
            ])
            ->addSubCommand('stop', [
                'help' => 'Stop vault'
            ])
            ->addSubCommand('restart', [
                'help' => 'Stop vault'
            ])
            ->addSubCommand('reset', [
                'help' => 'Wipe Vault and all its configuration'
            ])
            ->addSubCommand('status', [
                'help' => 'Get the status of the Vault instance'
            ])
            ->addSubCommand('create', [
                'help' => 'Initialize Vault and store the secrets safely'
            ])
            ->addSubCommand('env', [
                'help' => join(PHP_EOL, [
                    'Export the ENV variables for using the vault CLI tool directly.',
                    'Please run: eval $(sudo bownty-cli vault env)'
                ])
            ])
            ->addSubCommand('mounts', [
                'help' => 'Create the mounts required for global operation'
            ])
            ->addSubCommand('seal', [
                'help' => 'Seal the Vault'
            ])
            ->addSubCommand('unseal', [
                'help' => 'Unseal the Vault'
            ])
            ->addSubCommand('sync_vault_key', [
                'help' => 'Sync the Vault key into Consul (used by consul-template)'
            ])
            ->addSubCommand('wait_for', [
                'help' => 'Wait for something'
            ]);
    }
332841
public function getOptionParser()
    {
        $parser = new ConsoleOptionParser('console');
        $parser
            ->description("This shell clean the cache of your application.")
            ->command("cache.clear")
            ->addOption('all', [
                'short' => 'a',
                'help' => 'Clear all caches',
                'boolean' => true,
            ])

            ->addSubcommand('all', [
                'help' => 'Clear all caches',
            ])
            ;

        foreach ( $this->tasks as $task => $option ) {
            $classname = $this->taskClassname($task);

            $parser->addSubcommand($this->taskName($task), [
                'help' => $this->$classname->help(),
                'parser' => $this->$classname->getOptionParser(),
            ]);
        }

        return $parser;
    }
460824
protected function _parseOption($name, $params)
    {
        if (!isset($this->_options[$name])) {
            throw new ConsoleException($this->getOptionError($name));
        }
        $option = $this->_options[$name];
        $isBoolean = $option->isBoolean();
        $nextValue = $this->_nextToken();
        $emptyNextValue = (empty($nextValue) && $nextValue !== '0');
        if (!$isBoolean && !$emptyNextValue && !$this->_optionExists($nextValue)) {
            array_shift($this->_tokens);
            $value = $nextValue;
        } elseif ($isBoolean) {
            $value = true;
        } else {
            $value = $option->defaultValue();
        }
        if ($option->validChoice($value)) {
            if ($option->acceptsMultiple()) {
                $params[$name][] = $value;
            } else {
                $params[$name] = $value;
            }

            return $params;
        }

        return [];
    }
861914
private static OptionParser getParser() {
        /* parse options */
        OptionParser parser = new OptionParser();
        parser.accepts("help", "print help information");
        parser.accepts("urls", "[REQUIRED] bootstrap URLs")
                .withRequiredArg()
                .describedAs("bootstrap-url")
                .withValuesSeparatedBy(',')
                .ofType(String.class);
        parser.accepts("partitions", "partition-id")
                .withRequiredArg()
                .describedAs("partition-id")
                .withValuesSeparatedBy(',')
                .ofType(Integer.class);
        parser.accepts("store", "store name")
                .withRequiredArg()
                .describedAs("store-name")
                .ofType(String.class);
        parser.accepts("bad-key-file", "File name to which inconsistent keys are to be written.")
                .withRequiredArg()
                .describedAs("badKeyFileOut")
                .ofType(String.class);
        parser.accepts(ComparisonTypeArgument, "type of comparison to compare the values for the same key")
                .withRequiredArg()
                .describedAs("comparisonType")
                .ofType(String.class);
        return parser;
    }
1067943
private function getResolver()
    {
        if ($this->resolver === null) {
            $this->resolver = new OptionsResolver();
            $this->configureOptions($this->resolver);
        }

        return $this->resolver;
    }
219994
public function getOptionParser()
    {
        $parser = parent::getOptionParser();
        $parser->setDescription(
            'CakePHP Language String Extraction:'
        )->addOption('app', [
            'help' => 'Directory where your application is located.'
        ])->addOption('paths', [
            'help' => 'Comma separated list of paths.'
        ])->addOption('merge', [
            'help' => 'Merge all domain strings into the default.po file.',
            'choices' => ['yes', 'no']
        ])->addOption('relative-paths', [
            'help' => 'Use relative paths in the .pot file',
            'boolean' => true,
            'default' => false,
        ])->addOption('output', [
            'help' => 'Full path to output directory.'
        ])->addOption('files', [
            'help' => 'Comma separated list of files.'
        ])->addOption('exclude-plugins', [
            'boolean' => true,
            'default' => true,
            'help' => 'Ignores all files in plugins if this command is run inside from the same app directory.'
        ])->addOption('plugin', [
            'help' => 'Extracts tokens only from the plugin specified and puts the result in the plugin\'s Locale directory.'
        ])->addOption('ignore-model-validation', [
            'boolean' => true,
            'default' => false,
            'help' => 'Ignores validation messages in the $validate property.' .
                ' If this flag is not set and the command is run from the same app directory,' .
                ' all messages in model validation rules will be extracted as tokens.'
        ])->addOption('validation-domain', [
            'help' => 'If set to a value, the localization domain to be used for model validation messages.'
        ])->addOption('exclude', [
            'help' => 'Comma separated list of directories to exclude.' .
                ' Any path containing a path segment with the provided values will be skipped. E.g. test,vendors'
        ])->addOption('overwrite', [
            'boolean' => true,
            'default' => false,
            'help' => 'Always overwrite existing .pot files.'
        ])->addOption('extract-core', [
            'help' => 'Extract messages from the CakePHP core libs.',
            'choices' => ['yes', 'no']
        ])->addOption('no-location', [
            'boolean' => true,
            'default' => false,
            'help' => 'Do not write file locations for each extracted message.',
        ])->addOption('marker-error', [
            'boolean' => true,
            'default' => false,
            'help' => 'Do not display marker error.',
        ]);

        return $parser;
    }