Permalink
Browse files

Add ability to search module names/decriptions using regex

  • Loading branch information...
1 parent ae46ebc commit 88c01da54605b14cb4f21cf4fa5d6431b8023fa6 @perlpilot committed Aug 27, 2011
Showing with 14 additions and 1 deletion.
  1. +14 −1 bin/panda
View
@@ -3,7 +3,7 @@ use Shell::Command;
use Panda;
subset Command of Str where
- 'install' | 'list' | 'update' | 'info';
+ 'install' | 'list' | 'update' | 'info' | 'search';
sub installprojects($panda, @args) {
for @args -> $x {
@@ -27,6 +27,14 @@ sub listprojects($panda) {
}
}
+sub search-projects($panda, $string) {
+ for $panda.ecosystem.project-list -> $project {
+ my $p = $panda.ecosystem.get-project($project);
+ next unless $p.name ~~ / <$string> / || $p.metainfo<description> ~~ / <$string> /;
+ printf "%-24s %-10s %s\n",$p.name,$p.version, $p.metainfo<description>;
+ }
+}
+
sub projectinfo($panda, @args) {
for @args -> $p {
my $x = $panda.ecosystem.get-project($p);
@@ -67,6 +75,9 @@ sub execute(Command $c, $panda, @args) {
when 'info' {
projectinfo($panda, @args);
}
+ when 'search' {
+ search-projects($panda, @args);
+ }
}
}
@@ -119,6 +130,8 @@ Options:
Display this message and quit
install [module1 module2]
Install a modules(s)
+ search
+ Search module name/description using regex
list
List the available packages
info [module1 module2]

0 comments on commit 88c01da

Please sign in to comment.