-
-
Save zoffixznet/1203c8a3b93421bdd79fa3beaa57684c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PortUtils::Search { | |
constant PORTS = '/usr/ports/'; | |
has IO::Path @!cats = PORTS.IO.dir.map: |*.dir.grep: *.d; | |
method name(Str $query) { | |
my @matches = @!cats.grep: *.basename.contains: $query; | |
say “There are {+@matches} ports with names matching "$query":”; | |
.relative(PORTS).put for @matches; | |
} | |
} | |
PortUtils::Search.new.name: 'perl'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment