1
0
Fork 0

Fix InputOption requirement flags

pull/1006/head
Jordi Boggiano 2012-08-15 18:29:43 +02:00
parent 58b145b7ed
commit de4e9c4022
2 changed files with 8 additions and 8 deletions

View File

@ -36,7 +36,7 @@ class DependsCommand extends Command
->setDescription('Shows which packages depend on the given package') ->setDescription('Shows which packages depend on the given package')
->setDefinition(array( ->setDefinition(array(
new InputArgument('package', InputArgument::REQUIRED, 'Package to inspect'), new InputArgument('package', InputArgument::REQUIRED, 'Package to inspect'),
new InputOption('link-type', '', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'Link types to show (require, require-dev)', array_keys($this->linkTypes)) new InputOption('link-type', '', InputOption::VALUE_REQUIRED | InputOption::VALUE_IS_ARRAY, 'Link types to show (require, require-dev)', array_keys($this->linkTypes))
)) ))
->setHelp(<<<EOT ->setHelp(<<<EOT
Displays detailed information about where a package is referenced. Displays detailed information about where a package is referenced.

View File

@ -55,14 +55,14 @@ class InitCommand extends Command
->setName('init') ->setName('init')
->setDescription('Creates a basic composer.json file in current directory.') ->setDescription('Creates a basic composer.json file in current directory.')
->setDefinition(array( ->setDefinition(array(
new InputOption('name', null, InputOption::VALUE_NONE, 'Name of the package'), new InputOption('name', null, InputOption::VALUE_REQUIRED, 'Name of the package'),
new InputOption('description', null, InputOption::VALUE_NONE, 'Description of package'), new InputOption('description', null, InputOption::VALUE_REQUIRED, 'Description of package'),
new InputOption('author', null, InputOption::VALUE_NONE, 'Author name of package'), new InputOption('author', null, InputOption::VALUE_REQUIRED, 'Author name of package'),
// new InputOption('version', null, InputOption::VALUE_NONE, 'Version of package'), // new InputOption('version', null, InputOption::VALUE_NONE, 'Version of package'),
new InputOption('homepage', null, InputOption::VALUE_NONE, 'Homepage of package'), new InputOption('homepage', null, InputOption::VALUE_REQUIRED, 'Homepage of package'),
new InputOption('require', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'), new InputOption('require', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
new InputOption('require-dev', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require for development with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'), new InputOption('require-dev', null, InputOption::VALUE_IS_ARRAY | InputOption::VALUE_REQUIRED, 'Package to require for development with a version constraint, e.g. foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'),
new InputOption('minimum-stability', null, InputOption::VALUE_NONE, 'Minimum stability (empty or one of: '.implode(', ', array_keys(BasePackage::$stabilities)).')'), new InputOption('minimum-stability', null, InputOption::VALUE_REQUIRED, 'Minimum stability (empty or one of: '.implode(', ', array_keys(BasePackage::$stabilities)).')'),
)) ))
->setHelp(<<<EOT ->setHelp(<<<EOT
The <info>init</info> command creates a basic composer.json file The <info>init</info> command creates a basic composer.json file
@ -153,7 +153,7 @@ EOT
$cwd = realpath("."); $cwd = realpath(".");
if (false === $name = $input->getOption('name')) { if (!$name = $input->getOption('name')) {
$name = basename($cwd); $name = basename($cwd);
if (isset($git['github.user'])) { if (isset($git['github.user'])) {
$name = $git['github.user'] . '/' . $name; $name = $git['github.user'] . '/' . $name;
@ -193,7 +193,7 @@ EOT
); );
$input->setOption('description', $description); $input->setOption('description', $description);
if (false === $author = $input->getOption('author')) { if (null === $author = $input->getOption('author')) {
if (isset($git['user.name']) && isset($git['user.email'])) { if (isset($git['user.name']) && isset($git['user.email'])) {
$author = sprintf('%s <%s>', $git['user.name'], $git['user.email']); $author = sprintf('%s <%s>', $git['user.name'], $git['user.email']);
} }