/** * Parse command line arguments into CLImate arguments. * * @throws \Exception if required arguments aren't defined. * @param array $argv */ public function parse(array $argv = null) { $cliArguments = $this->arguments($argv); $unParsedArguments = $this->prefixedArguments($cliArguments); $this->nonPrefixedArguments($unParsedArguments); // After parsing find out which arguments were required but not // defined on the command line. $missingArguments = $this->filter->missing(); if (count($missingArguments) > 0) { throw new \Exception('The following arguments are required: ' . $this->summary->short($missingArguments) . '.'); } }
/** * Output a script's usage statement. * * @param CLImate $climate * @param array $argv */ public function usage(CLImate $climate, array $argv = null) { $this->summary->setClimate($climate)->setDescription($this->description)->setCommand($this->parser->command($argv))->setFilter($this->filter, $this->all())->output(); }