Permalink
Browse files

Fix InputOption requirement flags

  • Loading branch information...
Seldaek committed Aug 15, 2012
1 parent 58b145b commit de4e9c4022fb68f2f6bb79e0ed56e4ae8afdd6b7
Showing with 8 additions and 8 deletions.
  1. +1 −1 src/Composer/Command/DependsCommand.php
  2. +7 −7 src/Composer/Command/InitCommand.php
@@ -36,7 +36,7 @@ protected function configure()
->setDescription('Shows which packages depend on the given package')
->setDefinition(array(
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
Displays detailed information about where a package is referenced.
@@ -55,14 +55,14 @@ protected function configure()
->setName('init')
->setDescription('Creates a basic composer.json file in current directory.')
->setDefinition(array(
- new InputOption('name', null, InputOption::VALUE_NONE, 'Name of the package'),
- new InputOption('description', null, InputOption::VALUE_NONE, 'Description of package'),
- new InputOption('author', null, InputOption::VALUE_NONE, 'Author name of package'),
+ new InputOption('name', null, InputOption::VALUE_REQUIRED, 'Name of the package'),
+ new InputOption('description', null, InputOption::VALUE_REQUIRED, 'Description 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('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-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
The <info>init</info> command creates a basic composer.json file
@@ -153,7 +153,7 @@ protected function interact(InputInterface $input, OutputInterface $output)
$cwd = realpath(".");
- if (false === $name = $input->getOption('name')) {
+ if (!$name = $input->getOption('name')) {
$name = basename($cwd);
if (isset($git['github.user'])) {
$name = $git['github.user'] . '/' . $name;
@@ -193,7 +193,7 @@ function ($value) use ($name) {
);
$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'])) {
$author = sprintf('%s <%s>', $git['user.name'], $git['user.email']);
}

0 comments on commit de4e9c4

Please sign in to comment.