<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>bin/lhb</filename>
    </added>
    <added>
      <filename>lib/lighthouse_branch/command.rb</filename>
    </added>
    <added>
      <filename>lib/lighthouse_branch/command/base.rb</filename>
    </added>
    <added>
      <filename>lib/lighthouse_branch/commands/branch.rb</filename>
    </added>
    <added>
      <filename>lib/lighthouse_branch/commands/commit.rb</filename>
    </added>
    <added>
      <filename>lib/lighthouse_branch/commands/delete.rb</filename>
    </added>
    <added>
      <filename>test/command/test_base.rb</filename>
    </added>
    <added>
      <filename>test/commands/test_branch.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -51,7 +51,6 @@ end
 args = ARGV
 
 command = get_command(args)
-ticket_id = args.shift.to_i
 command = nil if ticket_id == 0
 
 lighthouse_branch = get_lighthouse_branch</diff>
      <filename>bin/lh-branch</filename>
    </modified>
    <modified>
      <diff>@@ -1,10 +1,29 @@
 require 'lighthouse-api'
+require 'grit'
+require File.join(File.dirname(__FILE__), 'lighthouse_branch', 'command', 'base')
+
+Dir.glob(File.join(File.dirname(__FILE__), 'lighthouse_branch', 'commands', '**.rb')).each { |command| require command }
 
 class LighthouseBranch
-  def initialize(account, token, project_id)
-    Lighthouse.account = account
-    Lighthouse.token = token
-    @project = Lighthouse::Project.find(project_id)
+  def initialize(project)
+    @project = project
+  end
+  
+  def self.get_lighthouse_account
+    repo = Grit::Repo.new(Dir.pwd)
+
+    Lighthouse.account = repo.config[&quot;lighthouse.account&quot;]
+    Lighthouse.token = repo.config[&quot;lighthouse.token&quot;]
+    
+    begin
+      @project = Lighthouse::Project.find(repo.config[&quot;lighthouse.project&quot;])
+    rescue
+      puts &quot;You must add your lighthouse account info to git config:&quot;
+      puts &quot;git config lighthouse.account [lighthouse account subdomain]&quot;
+      puts &quot;git config lighthouse.token [lighthouse API token]&quot;
+      puts &quot;git config lighthouse.project [lighthouse project id]&quot;
+      exit
+    end
   end
   
   def ticket(id)
@@ -14,4 +33,28 @@ class LighthouseBranch
   def branch_name(id)
     &quot;#{id}-#{ticket(id).title.gsub(/[^\w ]/, '').gsub(/[^a-z0-9]+/i, '-').downcase}&quot;
   end
+  
+  def self.invoke(args)
+    get_lighthouse_account
+    
+    if Command::Base.command_regexes.select{ |command| args.first =~ command }.empty?
+      unless (true if Float(args.first) rescue false)
+        usage
+        exit
+      end
+    end
+    
+    Command::Base.invoke(args, new(@project))
+  end
+  
+  def self.usage
+    puts &quot;Usage:&quot;
+    puts &quot;lh-branch [ticket_id]&quot;
+    puts &quot;lh-branch push [ticket_id] [remote name]&quot;
+    puts &quot;lh-branch pull [ticket_id] [remote name]&quot;
+    puts &quot;lh-branch merge [ticket_id]&quot;
+    puts &quot;lh-branch checkout [ticket_id]&quot;
+    puts &quot;lh-branch delete [ticket_id]&quot;
+    puts &quot;lh-branch resolve 1 [message]&quot;
+  end
 end
\ No newline at end of file</diff>
      <filename>lib/lighthouse_branch.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>495f90e2cfe5d871d157a0287414ef47cd40d5ec</id>
    </parent>
  </parents>
  <author>
    <name>Matt Pruitt</name>
    <email>guitsaru@gmail.com</email>
  </author>
  <url>http://github.com/guitsaru/lighthouse_branch/commit/49c88f250bdff59bb9f5546089cc20e529334998</url>
  <id>49c88f250bdff59bb9f5546089cc20e529334998</id>
  <committed-date>2009-06-22T20:37:59-07:00</committed-date>
  <authored-date>2009-06-22T20:37:37-07:00</authored-date>
  <message>Added commit, delete, and branch commands.  Shorter binary name.

[#2]</message>
  <tree>dbea1250a4db430ed9cbcdcac5eaf0965fe1601c</tree>
  <committer>
    <name>Matt Pruitt</name>
    <email>guitsaru@gmail.com</email>
  </committer>
</commit>
