parent
89cfde051d
commit
21a9f21cc8
|
@ -274,6 +274,14 @@ To list all of the available packages, you can use the `show` command.
|
||||||
php composer.phar show
|
php composer.phar show
|
||||||
```
|
```
|
||||||
|
|
||||||
|
To filter the list you can pass a package mask using wildcards.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
php composer.phar show monolog/*
|
||||||
|
|
||||||
|
monolog/monolog 1.19.0 Sends your logs to files, sockets, inboxes, databases and various web services
|
||||||
|
```
|
||||||
|
|
||||||
If you want to see the details of a certain package, you can pass the package
|
If you want to see the details of a certain package, you can pass the package
|
||||||
name.
|
name.
|
||||||
|
|
||||||
|
@ -305,10 +313,13 @@ php composer.phar show monolog/monolog 1.0.2
|
||||||
|
|
||||||
### Options
|
### Options
|
||||||
|
|
||||||
* **--installed (-i):** List the packages that are installed.
|
* **--all (-a):** List all packages available in all your repositories.
|
||||||
|
* **--installed (-i):** List the packages that are installed (this is enabled by default, and deprecated).
|
||||||
* **--platform (-p):** List only platform packages (php & extensions).
|
* **--platform (-p):** List only platform packages (php & extensions).
|
||||||
* **--self (-s):** List the root package info.
|
* **--self (-s):** List the root package info.
|
||||||
* **--tree (-t):** List the dependencies as a tree. Only usable when giving a single package name or combined with `-i`.
|
* **--tree (-t):** List your dependencies as a tree. If you pass a package name it will show the dependency tree for that package.
|
||||||
|
* **--name-only (-N):** List package names only.
|
||||||
|
* **--path (-P):** List package paths.
|
||||||
|
|
||||||
## browse / home
|
## browse / home
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,7 @@ class ShowCommand extends BaseCommand
|
||||||
->setAliases(array('info'))
|
->setAliases(array('info'))
|
||||||
->setDescription('Show information about packages')
|
->setDescription('Show information about packages')
|
||||||
->setDefinition(array(
|
->setDefinition(array(
|
||||||
new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect'),
|
new InputArgument('package', InputArgument::OPTIONAL, 'Package to inspect. Or a name including a wildcard (*) to filter lists of packages instead.'),
|
||||||
new InputArgument('version', InputArgument::OPTIONAL, 'Version or version constraint to inspect'),
|
new InputArgument('version', InputArgument::OPTIONAL, 'Version or version constraint to inspect'),
|
||||||
new InputOption('all', null, InputOption::VALUE_NONE, 'List all packages'),
|
new InputOption('all', null, InputOption::VALUE_NONE, 'List all packages'),
|
||||||
new InputOption('installed', 'i', InputOption::VALUE_NONE, 'List installed packages only (enabled by default, only present for BC).'),
|
new InputOption('installed', 'i', InputOption::VALUE_NONE, 'List installed packages only (enabled by default, only present for BC).'),
|
||||||
|
@ -131,8 +131,10 @@ EOT
|
||||||
$composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
|
$composer->getEventDispatcher()->dispatch($commandEvent->getName(), $commandEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$packageFilter = $input->getArgument('package');
|
||||||
|
|
||||||
// show single package or single version
|
// show single package or single version
|
||||||
if ($input->getArgument('package') || !empty($package)) {
|
if (($packageFilter && false === strpos($packageFilter, '*')) || !empty($package)) {
|
||||||
if (empty($package)) {
|
if (empty($package)) {
|
||||||
list($package, $versions) = $this->getPackage($installedRepo, $repos, $input->getArgument('package'), $input->getArgument('version'));
|
list($package, $versions) = $this->getPackage($installedRepo, $repos, $input->getArgument('package'), $input->getArgument('version'));
|
||||||
|
|
||||||
|
@ -188,6 +190,11 @@ EOT
|
||||||
|
|
||||||
// list packages
|
// list packages
|
||||||
$packages = array();
|
$packages = array();
|
||||||
|
if ($packageFilter) {
|
||||||
|
$packageFilter = '{^'.str_replace('\\*', '.*?', preg_quote($packageFilter)).'$}i';
|
||||||
|
} else {
|
||||||
|
$packageFilter = '{.}';
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($repos as $repo) {
|
foreach ($repos as $repo) {
|
||||||
if ($repo === $platformRepo) {
|
if ($repo === $platformRepo) {
|
||||||
|
@ -202,7 +209,9 @@ EOT
|
||||||
}
|
}
|
||||||
if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
|
if ($repo instanceof ComposerRepository && $repo->hasProviders()) {
|
||||||
foreach ($repo->getProviderNames() as $name) {
|
foreach ($repo->getProviderNames() as $name) {
|
||||||
$packages[$type][$name] = $name;
|
if (preg_match($packageFilter, $name)) {
|
||||||
|
$packages[$type][$name] = $name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
foreach ($repo->getPackages() as $package) {
|
foreach ($repo->getPackages() as $package) {
|
||||||
|
@ -210,7 +219,9 @@ EOT
|
||||||
|| !is_object($packages[$type][$package->getName()])
|
|| !is_object($packages[$type][$package->getName()])
|
||||||
|| version_compare($packages[$type][$package->getName()]->getVersion(), $package->getVersion(), '<')
|
|| version_compare($packages[$type][$package->getName()]->getVersion(), $package->getVersion(), '<')
|
||||||
) {
|
) {
|
||||||
$packages[$type][$package->getName()] = $package;
|
if (preg_match($packageFilter, $package->getName())) {
|
||||||
|
$packages[$type][$package->getName()] = $package;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue