Skip to content
This repository has been archived by the owner on Jan 16, 2019. It is now read-only.

Commit

Permalink
fix wrong order of command line arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
mikey179 committed Jun 17, 2015
1 parent 2c87130 commit c1af1ba
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
5.0.1 (2015-06-17)
------------------

* fixed wrong order of command line arguments


5.0.0 (2015-05-28)
------------------

Expand Down
5 changes: 3 additions & 2 deletions src/main/php/input/RequestParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,14 @@ private function createHelp($object, $group)
if (substr($targetMethod->paramName(), 0, 5) !== 'argv.') {
$options[$this->getOptionName($targetMethod)] = $targetMethod->paramDescription();
} elseif (!$targetMethod->isRequired()) {
$parameters[] = '[' . $targetMethod->paramDescription() . ']';
$parameters[$targetMethod->paramName()] = '[' . $targetMethod->paramDescription() . ']';
} else {
$parameters[] = $targetMethod->paramDescription();
$parameters[$targetMethod->paramName()] = $targetMethod->paramDescription();
}
}

$options['-h or --help'] = 'Prints this help.';
asort($parameters);
return $this->creatHelpWriter(
$this->readAppDescription($object),
$this->request->readEnv('SCRIPT_NAME')->unsecure(),
Expand Down
11 changes: 11 additions & 0 deletions src/test/helper/BrokeredUserInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,17 @@ public function isVerbose()
return $this->verbose;
}

/**
* test method
*
* @Request[String](paramName='argv.1', paramGroup='arg', paramDescription='other-id')
* @param string $arg
*/
public function setOtherArgument($arg)
{
$this->bar = $arg;
}

/**
* test method
*
Expand Down
2 changes: 1 addition & 1 deletion src/test/php/input/RequestParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function helpClosureRendersHelpToOutputStream()
$cae->writeTo($memoryOutputStream);
assertEquals(
"Real awesome command line app (c) 2012 Stubbles Development Team
Usage: bin/http [options] [application-id]
Usage: bin/http [options] [application-id] [other-id]
Options:
--verbose
-v
Expand Down

0 comments on commit c1af1ba

Please sign in to comment.