From 5ed001765f74f0066399c4c2347fc04145fbc03d Mon Sep 17 00:00:00 2001 From: Evan Mattson Date: Wed, 10 Dec 2014 00:16:18 -0500 Subject: [PATCH 1/2] allow package type to be set with init command --- src/Composer/Command/InitCommand.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Composer/Command/InitCommand.php b/src/Composer/Command/InitCommand.php index e8826687a..84689c182 100644 --- a/src/Composer/Command/InitCommand.php +++ b/src/Composer/Command/InitCommand.php @@ -65,6 +65,7 @@ class InitCommand extends Command 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('type', null, InputOption::VALUE_OPTIONAL, 'Type 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"'), @@ -86,7 +87,7 @@ EOT { $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))); @@ -258,6 +259,14 @@ EOT ); $input->setOption('stability', $minimumStability); + $type = $input->getOption('type') ?: false; + $type = $dialog->ask( + $output, + $dialog->getQuestion('Type', $type), + $type + ); + $input->setOption('type', $type); + $license = $input->getOption('license') ?: false; $license = $dialog->ask( $output, From ec9eb2b7993eddcaabef22ac1b85141dbc595734 Mon Sep 17 00:00:00 2001 From: Evan Mattson Date: Tue, 24 Feb 2015 14:59:42 -0500 Subject: [PATCH 2/2] update init type question --- src/Composer/Command/InitCommand.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Composer/Command/InitCommand.php b/src/Composer/Command/InitCommand.php index 84689c182..5dcfcc4a8 100644 --- a/src/Composer/Command/InitCommand.php +++ b/src/Composer/Command/InitCommand.php @@ -262,7 +262,7 @@ EOT $type = $input->getOption('type') ?: false; $type = $dialog->ask( $output, - $dialog->getQuestion('Type', $type), + $dialog->getQuestion('Package Type', $type), $type ); $input->setOption('type', $type);