1
0
Fork 0

Merge pull request #3531 from aaemnnosttv/feat/init-cmd

allow package type to be set with init command
pull/3962/head
Jordi Boggiano 2015-04-21 19:03:18 +01:00
commit 68b5bc3560
1 changed files with 10 additions and 1 deletions

View File

@ -65,6 +65,7 @@ class InitCommand extends Command
new InputOption('description', null, InputOption::VALUE_REQUIRED, 'Description of package'), new InputOption('description', null, InputOption::VALUE_REQUIRED, 'Description of package'),
new InputOption('author', null, InputOption::VALUE_REQUIRED, '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('type', null, InputOption::VALUE_OPTIONAL, 'Type of package'),
new InputOption('homepage', null, InputOption::VALUE_REQUIRED, '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"'),
@ -86,7 +87,7 @@ EOT
{ {
$dialog = $this->getHelperSet()->get('dialog'); $dialog = $this->getHelperSet()->get('dialog');
$whitelist = array('name', 'description', 'author', 'homepage', 'require', 'require-dev', 'stability', 'license'); $whitelist = array('name', 'description', 'author', 'type', 'homepage', 'require', 'require-dev', 'stability', 'license');
$options = array_filter(array_intersect_key($input->getOptions(), array_flip($whitelist))); $options = array_filter(array_intersect_key($input->getOptions(), array_flip($whitelist)));
@ -258,6 +259,14 @@ EOT
); );
$input->setOption('stability', $minimumStability); $input->setOption('stability', $minimumStability);
$type = $input->getOption('type') ?: false;
$type = $dialog->ask(
$output,
$dialog->getQuestion('Package Type', $type),
$type
);
$input->setOption('type', $type);
$license = $input->getOption('license') ?: false; $license = $input->getOption('license') ?: false;
$license = $dialog->ask( $license = $dialog->ask(
$output, $output,