Chris Nandor has been bugging me to use the Github tools he helped to develop for Marchex, so when I posted about Hound he showed me another way to search multiple GitHub repos at the same time. This version only works if everything is on GitHub (or your Enterprise version of that), but the Hound version can work with whatever mix of version control systems have, either local, remote, or both.

This task is really simple, so it’s not that impressive for those tools, but you can still search multiple GitHub repos. It only looks like you need a GitHub personal access token because the tools assume you’ll want to do all the other stuff too. The stuff here doesn’t actually use the GitHub API.

Now I put it all together. This is really the sort of thing that Perl 5 was made to do. Here’s a quickie Perl 5 example (and hey, last time is was Go, so I’m getting closer). This constructs the right query, submits it to GitHub, and opens your browser to the results.

#!/Users/brian/bin/perls/perl5.14.2 use v5.10; # You might have Enterprise, so this would be different $ENV{GITHUB_HOST} //= 'github.com'; $ENV{GITHUB_TOKEN} //= 'vanilla nut taps'; # can be anything, but var needs to be defined # https://github.com/Marchex/github-api-tools my $binary = '/Users/brian/bin/perls/github_search5.14.2'; my $repos = join ' ', map { "repo:$_" } qw( rakudo/rakudo perl6/nqp perl6/doc perl6/roast perl6/specs ); @ARGV = qw(Mayor of Dunkin) unless @ARGV; my @command = ( $binary, '-O', '-f', "'$repos'", @ARGV ); say "@command"; system { $command[0] } @command;

To run it, I give it something to search: