Skip to content

Instantly share code, notes, and snippets.

@yaotti
Created December 8, 2010 01:31
Show Gist options
  • Save yaotti/732759 to your computer and use it in GitHub Desktop.
Save yaotti/732759 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use LWP::UserAgent;
use Getopt::Long;
sub listup_changes {
my $ua = LWP::UserAgent->new;
my $response = $ua->get(qw!http://www.emacswiki.org/emacs/?action=rc;raw=1!);
for (split /\n/, $response->decoded_content) {
next unless /link: (.+)$/;
print $1, "\n";
}
}
sub open_it {
my $url = shift;
`open $url`;
}
GetOptions("init=s" => \my $init,
"action=s" => \my $action);
if ($init) {
if ($init eq 'list') {
listup_changes;
}
}elsif ($action) {
my $candidate = shift;
if ($action eq 'open') {
open_it($candidate);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment