Skip to content

Instantly share code, notes, and snippets.

@smathy
Created December 18, 2009 16:50
Show Gist options
  • Save smathy/259605 to your computer and use it in GitHub Desktop.
Save smathy/259605 to your computer and use it in GitHub Desktop.
Scripts for opening browser to github or lighthouse from console
alias gh=~/bin/gh.sh
alias lh=~/bin/lh.pl
#!/bin/sh
open `git config -l | sed -En 's/remote.origin.url=git(@|:\/\/)github.com(:|\/)(.+)\/(.+).git/https:\/\/github.com\/\3\/\4/p'`
#!/usr/bin/env perl
use strict;
use warnings;
( my $branch=`git branch | grep '*' | cut -d' ' -f2` ) =~ s/\s//g;
my %projects = (
'AMCO-Online' => 38551,
'AMCO-World' => 38553,
'SEQ' => 38556,
'Tiendita' => 38555,
'Visor' => 38552,
'ops' => 40578,
);
my($repo) = `git config -l | grep remote.origin.url` =~ m{git\@github.com:amco/(.*).git};
my $root_url = qq{https://amco.lighthouseapp.com/projects};
if( defined($repo) and exists( $projects{$repo})) {
my $p = $projects{$repo};
if( $branch =~ /([0-9]+)/ ) {
exec( qq{open $root_url/$p/tickets/$1} );
}
else {
exec( qq{open $root_url/$p/tickets?q=state:open} );
}
}
else {
print "\e[31;1mNot in a recognized git project.\e[0m\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment