added description to show command, searching in description aswell
parent
edf93f1fcc
commit
741a66e504
|
@ -18,6 +18,7 @@ use Symfony\Component\Console\Output\OutputInterface;
|
||||||
use Composer\Repository\CompositeRepository;
|
use Composer\Repository\CompositeRepository;
|
||||||
use Composer\Repository\PlatformRepository;
|
use Composer\Repository\PlatformRepository;
|
||||||
use Composer\Repository\ComposerRepository;
|
use Composer\Repository\ComposerRepository;
|
||||||
|
use Composer\Package\PackageInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Robert Schönthal <seroscho@googlemail.com>
|
* @author Robert Schönthal <seroscho@googlemail.com>
|
||||||
|
@ -60,8 +61,8 @@ EOT
|
||||||
|
|
||||||
foreach ($repos->getPackages() as $package) {
|
foreach ($repos->getPackages() as $package) {
|
||||||
foreach ($tokens as $token) {
|
foreach ($tokens as $token) {
|
||||||
if (false === ($pos = strpos($package->getName(), $token)) && (false === strpos(join(',',$package->getKeywords() ?: array()), $token))) {
|
if ($this->isUnmatchedPackage($package, $token)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (false !== ($pos = strpos($package->getName(), $token))) {
|
if (false !== ($pos = strpos($package->getName(), $token))) {
|
||||||
|
@ -83,4 +84,19 @@ EOT
|
||||||
$output->writeln($name .' <comment>:</comment> '. join(', ', $versions));
|
$output->writeln($name .' <comment>:</comment> '. join(', ', $versions));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* tries to find a token within the name/keywords/description
|
||||||
|
*
|
||||||
|
* @param PackageInterface $package
|
||||||
|
* @param string $token
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
private function isUnmatchedPackage(PackageInterface $package, $token)
|
||||||
|
{
|
||||||
|
return (false === strpos($package->getName(), $token)) &&
|
||||||
|
(false === strpos(join(',',$package->getKeywords() ?: array()), $token)) &&
|
||||||
|
(false === strpos($package->getDescription(), $token))
|
||||||
|
;
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -132,7 +132,7 @@ EOT
|
||||||
*/
|
*/
|
||||||
protected function printMeta(InputInterface $input, OutputInterface $output, PackageInterface $package, RepositoryInterface $installedRepo, RepositoryInterface $repos)
|
protected function printMeta(InputInterface $input, OutputInterface $output, PackageInterface $package, RepositoryInterface $installedRepo, RepositoryInterface $repos)
|
||||||
{
|
{
|
||||||
$output->writeln('<info>name</info> : ' . $package->getPrettyName());
|
$output->writeln('<info>name</info> : <comment>' . $package->getPrettyName(). '</comment> '.$package->getDescription());
|
||||||
$this->printVersions($input, $output, $package, $installedRepo, $repos);
|
$this->printVersions($input, $output, $package, $installedRepo, $repos);
|
||||||
$output->writeln('<info>type</info> : ' . $package->getType());
|
$output->writeln('<info>type</info> : ' . $package->getType());
|
||||||
$output->writeln('<info>names</info> : ' . join(', ', $package->getNames()));
|
$output->writeln('<info>names</info> : ' . join(', ', $package->getNames()));
|
||||||
|
|
Loading…
Reference in New Issue