Return args parser

@return program parser
186185
private static OptionParser getParser() {
        OptionParser parser = new OptionParser();
        parser.accepts("help", "print help information");
        parser.accepts("url", "[REQUIRED] bootstrap URL")
              .withRequiredArg()
              .describedAs("bootstrap-url for the cluster in which a node is to be replaced")
              .ofType(String.class);
        parser.accepts("node", "[REQUIRED] node id.")
              .withRequiredArg()
              .describedAs("node id which needs to be replaced by the new node")
              .ofType(Integer.class);
        parser.accepts("newurl", "[REQUIRED] new bootstrap-url")
              .withRequiredArg()
              .describedAs("bootstrap-url for the new cluster, which will replace the node id")
              .ofType(String.class);
        parser.accepts("skip-restore", "do not restore data from existing machine");
        parser.accepts("parallelism", "parallel data restores.")
              .withRequiredArg()
              .describedAs("number of data restores to happen in parallel")
              .ofType(Integer.class)
              .defaultsTo(3);
        return parser;
    }
542187
private function getParser()
    {
        if (null === $this->parser) {
            $this->parser = new Parser;
            $this->fixUniqueHeaders();
            $this->parser->setText($this->toString());
        }
        return $this->parser;
    }
862818
def getParser():
    ""
    parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter, description=__description__)
    parser.add_argument('input', help='the input image')
    parser.add_argument('output', help='the output image')
    parser.add_argument('shape', type=argparseu.sequenceOfIntegersGt, help='the desired shape in colon-separated values, e.g. 255,255,32')

    parser.add_argument('-v', '--verbose', dest='verbose', action='store_true', help='verbose output')
    parser.add_argument('-d', dest='debug', action='store_true', help='Display debug information.')
    parser.add_argument('-f', '--force', dest='force', action='store_true', help='overwrite existing files')
    return parser
1241850
def get_parser(parser=None):
    """"""
    from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter
    if parser is None:
        parser = ArgumentParser(description=__doc__,
                                formatter_class=ArgumentDefaultsHelpFormatter)
    subparsers = parser.add_subparsers()
    pkg_init_parser = subparsers.add_parser('init')
    pkg_init_parser.add_argument("root",
                                 nargs='?',
                                 help="project root - should be empty")
    pkg_init_parser.set_defaults(func=run_init)
    return parser
731996
public function getParser()
    {
        if (true === empty($this->parser)) {
            $typeParserClassName = sprintf('\ReadmeGen\Vcs\Type\%s', ucfirst($this->config['vcs']));

            if (false === class_exists($typeParserClassName)) {
                throw new \InvalidArgumentException(sprintf('Class "%s" does not exist', $typeParserClassName));
            }

            $this->parser = new Parser(new $typeParserClassName());
        }

        return $this->parser;
    }
774730
public function getOptionParser()
    {
        $parser = parent::getOptionParser();
        $parser->setDescription(
            (string)__('Synchronize local and remote calendars with the database')
        );

        $parser->addOption('start', [
            'description' => (string)__('Specify start interval for the events to fetch'),
            'help' => (string)__("Start date 'YYYY-MM-DD HH:MM:SS' for events to fetch"),
        ]);

        $parser->addOption('end', [
            'description' => (string)__('Specify end interval for the events to fetch'),
            'help' => (string)__("End date 'YYYY-MM-DD HH:MM:SS' for events to fetch"),
        ]);

        return $parser;
    }
756512
public function createTypeParser()
    {
        $type = $this->configType();
        if (is_array($type)) {
            return Injector::inst()->createWithArgs(
                TypeParserInterface::class . '.array',
                [
                    StaticSchema::inst()->typeName(get_class($this->owner)),
                    $type
                ]
            );
        }

        return Injector::inst()->createWithArgs(
            TypeParserInterface::class . '.string',
            [(string) $type]
        );
    }
1347105
public function getParser()
    {
        if ($this->parser == null) {
            $this->parser = $this->container->get('thelia.parser');

            // Define the current back-office template that should be used
            $this->parser->setTemplateDefinition(
                $this->parser->getTemplateHelper()->getActiveAdminTemplate()
            );
        }

        return $this->parser;
    }
1164131
public function getOptionParser()
    {
        $parser = parent::getOptionParser();

        $parser->setDescription(
            'Get the list of available shells for this CakePHP application.'
        )->addOption('xml', [
            'help' => 'Get the listing as XML.',
            'boolean' => true
        ])->addOption('version', [
            'help' => 'Prints the currently installed version of CakePHP. (deprecated - use `cake --version` instead)',
            'boolean' => true
        ]);

        return $parser;
    }
397282
public function getArguments() {
        if (is_null($this->result)) {
            $this->parse();
        }
        return $this->result[Parser::RESULT_ARGUMENTS];
    }
671169
def args(self):
        """"""
        if self._args is None:
            parser = self._build_parser()
            self._args = parser.parse_args()
        return self._args
117990
public static function getParsers()
    {
        $parsers = [];
        $parserClassList = ClassMapGenerator::createMap(base_path().'/vendor/abuseio');
        /** @noinspection PhpUnusedParameterInspection */
        $parserClassListFiltered = array_where(
            array_keys($parserClassList),
            function ($value, $key) {
                // Get all parsers, ignore all other packages.
                if (strpos($value, 'AbuseIO\Parsers\\') !== false) {
                    return $value;
                }
                return false;
            }
        );

        $parserList = array_map('class_basename', $parserClassListFiltered);
        foreach ($parserList as $parser) {
            if (!in_array($parser, ['Factory', 'Parser'])) {
                $parsers[] = $parser;
            }
        }
        return $parsers;
    }
706189
def get_application_parser(commands):
    

    parser = argparse.ArgumentParser(
        description=configuration.APPLICATION_DESCRIPTION,
        usage =configuration.EXECUTABLE_NAME + ' [sub-command] [options]',
        add_help=False)

    parser.add_argument(
        'sub_command',
        choices=[name for name in commands],
        nargs="?")

    parser.add_argument("-h", "--help", action="store_true")
    return parser
1289670
private function parseArgs(): array
    {
        if (null === $this->options && count($this->longopts) === 0 && null === $this->userInput) {
            return $this->fixArgs($_SERVER['argv']);
        }

        if (null !== $this->userInput) {
            $this->collectOptionsFromUserInputClass();
        }

        $parseCommandLineOptions = $this->cliOptionParser;
        $parsedVars = $parseCommandLineOptions($this->options, $this->longopts);
        if (false === $parsedVars) {
            throw new \RuntimeException(
                    'Error parsing "' . join(' ', $_SERVER['argv'])
                    . '" with ' . $this->options
                    . ' and ' . join(' ', $this->longopts)
            );
        }

        return $this->fixArgs($_SERVER['argv'], $parsedVars);
    }
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;
    }
529492
public function getOptionParser() {
		$file = Runner::ROBOFILE;
		if (Configure::check('Path.robofile')) {
			$file = Configure::read('Path.robofile');
		}

		$parser = new ConsoleOptionParser('robot', false);
		$parser->description(
			'This shell provides a Robo runner.' .
			"\n\n" .
			'You will need to have robo installed for this Shell to work. '
		)->addOption('config', [
			'help' => __d('cake_console', 'Path to your RoboFile class'),
			'default' => $file
		]);
		return $parser;
	}
34940
public function getOptionParser()
    {
        $startParserArguments = [
            'options' => [
                'user'               => [
                    'short' => 'u',
                    'help'  => __d('cake_resque', 'User running the workers'),
                ],
                'queue'              => [
                    'short' => 'q',
                    'help'  => __d('cake_resque', 'Name of the queue. If multiple queues, separe with comma.'),
                ],
                'interval'           => [
                    'short' => 'i',
                    'help'  => __d('cake_resque', 'Pause time in seconds between each works'),
                ],
                'workers'            => [
                    'short' => 'n',
                    'help'  => __d('cake_resque', 'Number of workers to fork'),
                ],
                'log'                => [
                    'short' => 'l',
                    'help'  => __d('cake_resque', 'Log path'),
                ],
                'log-handler'        => [
                    'help' => __d('cake_resque', 'Log Handler to use for logging.'),
                ],
                'log-handler-target' => [
                    'help' => __d('cake_resque', 'Log Handler arguments'),
                ],
                'verbose'            => [
                    'short'   => 'v',
                    'help'    => __d('cake_resque', 'Log more verbose informations'),
                    'boolean' => true,
                ],
                'debug'              => [
                    'short'   => 'd',
                    'help'    => __d('cake_resque', 'Print debug informations'),
                    'boolean' => true,
                ],
            ],
        ];

        $startSchedulerParserArguments = [
            'options' => [
                'user'               => [
                    'short' => 'u',
                    'help'  => __d('cake_resque', 'User running the workers'),
                ],
                'interval'           => [
                    'short' => 'i',
                    'help'  => __d('cake_resque', 'Pause time in seconds between each works'),
                ],
                'log'                => [
                    'short' => 'l',
                    'help'  => __d('cake_resque', 'Log path'),
                ],
                'log-handler'        => [
                    'help' => __d('cake_resque', 'Log Handler to use for logging.'),
                ],
                'log-handler-target' => [
                    'help' => __d('cake_resque', 'Log Handler arguments'),
                ],
                'verbose'            => [
                    'short'   => 'v',
                    'help'    => __d('cake_resque', 'Log more verbose informations'),
                    'boolean' => true,
                ],
            ],
        ];

        $stopParserArguments = [
            'options'     => [
                'force' => [
                    'short'   => 'f',
                    'help'    => __d('cake_resque', 'Force workers shutdown, forcing all the current jobs to finish (and fail)'),
                    'boolean' => true,
                ],
                'all'   => [
                    'short'   => 'a',
                    'help'    => __d('cake_resque', 'Shutdown all workers'),
                    'boolean' => true,
                ],
            ],
            'description' => [
                __d('cake_resque', 'Stop one or all workers'),
                __d('cake_resque', 'Unless you force the stop with the --force option,'),
                __d('cake_resque', 'the worker will wait for all jobs to complete'),
                __d('cake_resque', 'before shutting down'),
            ],
        ];

        $pauseParserArguments = [
            'options'     => [
                'all'   => [
                    'short'   => 'a',
                    'help'    => __d('cake_resque', 'Pause all workers'),
                    'boolean' => true,
                ],
                'debug' => [
                    'short'   => 'd',
                    'help'    => __d('cake_resque', 'Print debug informations'),
                    'boolean' => true,
                ],
            ],
            'description' => [
                __d('cake_resque', 'Pause one or all workers'),
                __d('cake_resque', 'Pausing is only supported on Unix system,'),
                __d('cake_resque', 'with PHP pcntl extension installed'),
            ],
        ];

        $resumeParserArguments = [
            'options'     => [
                'all'   => [
                    'short'   => 'a',
                    'help'    => __d('cake_resque', 'Resume all paused workers'),
                    'boolean' => true,
                ],
                'debug' => [
                    'short'   => 'd',
                    'help'    => __d('cake_resque', 'Print debug informations'),
                    'boolean' => true,
                ],
            ],
            'description' => [
                __d('cake_resque', 'Resume one or all paused workers'),
                __d('cake_resque', 'Resuming is only supported on Unix system,'),
                __d('cake_resque', 'with PHP pcntl extension installed'),
            ],
        ];

        $cleanupParserArguments = [
            'options'     => [
                'all'   => [
                    'short'   => 'a',
                    'help'    => __d('cake_resque', 'Clean up all workers'),
                    'boolean' => true,
                ],
                'debug' => [
                    'short'   => 'd',
                    'help'    => __d('cake_resque', 'Print debug informations'),
                    'boolean' => true,
                ],
            ],
            'description' => [
                __d('cake_resque', 'Cleaning Up one or all paused workers'),
                __d('cake_resque', 'Cleaning Up will immedately terminate the job'),
                __d('cake_resque', 'the worker is currently working on.'),
                __d('cake_resque', 'Resuming is only supported on Unix system,'),
                __d('cake_resque', 'with PHP pcntl extension installed'),
            ],
        ];

        $clearParserArguments = [
            'options'     => [
                'all'   => [
                    'short'   => 'a',
                    'help'    => __d('cake_resque', 'Clear all queues'),
                    'boolean' => true,
                ],
                'debug' => [
                    'short'   => 'd',
                    'help'    => __d('cake_resque', 'Print debug informations'),
                    'boolean' => true,
                ],
            ],
            'description' => [
                __d('cake_resque', 'Clear one or all queues'),
                __d('cake_resque', 'Clearing a queue will remove all its jobs'),
            ],
        ];

        return parent::getOptionParser()
            ->description(
                __d('cake_resque', "A Shell to manage PHP Resque") . "\n" .
                __d('cake_resque', "Version " . CakeResqueShell::VERSION) . "\n" .
                "Wan Chen (" . date('Y') . ")"
            )
            ->addSubcommand('start', [
                'help'   => __d('cake_resque', 'Start a new worker.'),
                'parser' => $startParserArguments,
            ])
            ->addSubcommand('startscheduler', [
                'help'   => __d('cake_resque', 'Start a new scheduler worker.'),
                'parser' => $startSchedulerParserArguments,
            ])
            ->addSubcommand('stop', [
                'help'   => __d('cake_resque', 'Stop a worker.'),
                'parser' => $stopParserArguments,
            ])
            ->addSubcommand('pause', [
                'help'   => __d('cake_resque', 'Pause a worker.'),
                'parser' => $pauseParserArguments,
            ])
            ->addSubcommand('resume', [
                'help'   => __d('cake_resque', 'Resume a paused worker.'),
                'parser' => $resumeParserArguments,
            ])
            ->addSubcommand('cleanup', [
                'help'   => __d('cake_resque', 'Immediately terminate a worker job execution.'),
                'parser' => $cleanupParserArguments,
            ])
            ->addSubcommand('restart', [
                'help'   => __d('cake_resque', 'Stop all Resque workers, and start a new one.'),
                'parser' => array_merge_recursive($startParserArguments, $stopParserArguments),
            ])
            ->addSubcommand('clear', [
                'help'   => __d('cake_resque', 'Clear all jobs inside a queue'),
                'parser' => $clearParserArguments,
            ])
            ->addSubcommand('reset', [
                'help'   => __d('cake_resque', 'Reset CakeResque internal worker\'s saved status'),
                'parser' => $clearParserArguments,
            ])
            ->addSubcommand('stats', [
                'help' => __d('cake_resque', 'View stats about processed/failed jobs.'),
            ])
            ->addSubcommand('tail', [
                'help' => __d('cake_resque', 'Tail the workers logs.'),
            ])
            ->addSubcommand('track', [
                'help' => __d('cake_resque', 'Track a job status.'),
            ])
            ->addSubcommand('load', [
                'help' => __d('cake_resque', 'Load a set of predefined workers.'),
            ]);
    }