From 449ecf098df9a63bb3eef898db1ef3a4d7bcd279 Mon Sep 17 00:00:00 2001 From: Brett Santore Date: Thu, 14 Dec 2017 11:44:54 -0500 Subject: [PATCH] clarify optionality of package in require command --- doc/03-cli.md | 2 ++ src/Composer/Command/RequireCommand.php | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/doc/03-cli.md b/doc/03-cli.md index 545df24b0..755475fd3 100644 --- a/doc/03-cli.md +++ b/doc/03-cli.md @@ -191,6 +191,8 @@ to the command. php composer.phar require vendor/package:2.* vendor/package2:dev-master ``` +If you do not specify a package, composer will prompt you to search for a package, and given results, provide a list of matches to require. + ### Options * **--dev:** Add packages to `require-dev`. diff --git a/src/Composer/Command/RequireCommand.php b/src/Composer/Command/RequireCommand.php index 0bd7f6993..209d1d2fe 100644 --- a/src/Composer/Command/RequireCommand.php +++ b/src/Composer/Command/RequireCommand.php @@ -38,7 +38,7 @@ class RequireCommand extends InitCommand ->setName('require') ->setDescription('Adds required packages to your composer.json and installs them.') ->setDefinition(array( - new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Required package name optionally including a version constraint, e.g. foo/bar or foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'), + new InputArgument('packages', InputArgument::IS_ARRAY | InputArgument::OPTIONAL, 'Optional package name can also include a version constraint, e.g. foo/bar or foo/bar:1.0.0 or foo/bar=1.0.0 or "foo/bar 1.0.0"'), new InputOption('dev', null, InputOption::VALUE_NONE, 'Add requirement to require-dev.'), new InputOption('prefer-source', null, InputOption::VALUE_NONE, 'Forces installation from package sources when possible, including VCS information.'), new InputOption('prefer-dist', null, InputOption::VALUE_NONE, 'Forces installation from package dist even for dev versions.'), @@ -60,6 +60,9 @@ class RequireCommand extends InitCommand ->setHelp(<<