<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -31,10 +31,10 @@ lh-branch delete [ticket_id]: Deletes the ticket's branch.
 lh-branch delete_remote [ticket_id] [remote name]: Deletes the ticket's branch on the remote server.
     lh-branch delete_remote 1 origin #=&gt; git push origin :1-ticket-title
 
-lh-branch commit 1 [message]: Creates a commit that references the ticket
+lh-branch commit [ticket_id] [message]: Creates a commit that references the ticket
     lh-branch commit 1 &quot;Made some changes&quot; #=&gt; git commit -a -m &quot;Made some changes\n\n[#1]&quot;
 
-lh-branch resolve 1 [message]: Creates a commit that will mark the ticket resolved.
+lh-branch resolve [ticket_id] [message]: Creates a commit that will mark the ticket resolved.
     lh-branch resolve 1 &quot;Fixed the bug.&quot; #=&gt; git commit -a -m &quot;Fixed the bug\n\n[#1 state:resolved]&quot;
 
 == Copyright</diff>
      <filename>README.rdoc</filename>
    </modified>
    <modified>
      <diff>@@ -2,109 +2,5 @@
 
 require 'rubygems'
 require File.join(File.dirname(__FILE__), '..', 'lib', 'lighthouse_branch')
-require 'grit'
 
-def get_command(args)
-  case args[0]
-  when nil
-    return nil
-  when /push/i
-    args.shift
-    return 'push'
-  when /pull/i
-    args.shift
-    return 'pull'
-  when /merge/i
-    args.shift
-    return 'merge'
-  when /checkout/i
-    args.shift
-    return 'checkout'
-  when /delete/i
-    args.shift
-    return 'delete'
-  when /resolve/i
-    args.shift
-    return 'resolve'
-  else return 'branch'
-  end
-end
-
-def get_lighthouse_branch
-  repo = Grit::Repo.new(Dir.pwd)
-
-  lighthouse_account = repo.config[&quot;lighthouse.account&quot;]
-  lighthouse_token = repo.config[&quot;lighthouse.token&quot;]
-  lighthouse_project = repo.config[&quot;lighthouse.project&quot;]
-  
-  if lighthouse_account.nil? || lighthouse_token.nil? || lighthouse_project.nil?
-    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
-  
-  return LighthouseBranch.new(lighthouse_account, lighthouse_token, lighthouse_project)
-end
-
-args = ARGV
-
-command = get_command(args)
-command = nil if ticket_id == 0
-
-lighthouse_branch = get_lighthouse_branch
-
-case command
-when nil
-  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;
-when 'branch'
-  if args.size != 0
-    puts &quot;Usage: lh-branch [ticket_id]&quot;
-    exit
-  end
-  system(&quot;git checkout -b #{lighthouse_branch.branch_name(ticket_id)}&quot;)
-when 'delete'
-  if args.size != 0
-    puts &quot;Usage: lh-branch delete [ticket_id]&quot;
-    exit
-  end
-  system(&quot;git branch -d #{lighthouse_branch.branch_name(ticket_id)}&quot;)
-when 'push'
-  if args.size != 1
-    puts &quot;Usage: lh-branch push [ticket_id] [remote name]&quot;
-    exit
-  end
-  system(&quot;git push #{args.shift} #{lighthouse_branch.branch_name(ticket_id)}&quot;)
-when 'pull'
-  if args.size != 1
-    puts &quot;Usage: lh-branch pull [ticket_id] [remote name]&quot;
-    exit
-  end
-  system(&quot;git pull #{args.shift} #{lighthouse_branch.branch_name(ticket_id)}&quot;)
-when 'checkout'
-  if args.size != 0
-    puts &quot;Usage: lh-branch checkout [ticket_id]&quot;
-    exit
-  end
-  system(&quot;git checkout #{lighthouse_branch.branch_name(ticket_id)}&quot;)
-when 'merge'
-  if args.size != 0
-    puts &quot;Usage: lh-branch merge [ticket_id]&quot;
-    exit
-  end
-  system(&quot;git merge #{lighthouse_branch.branch_name(ticket_id)}&quot;)
-when 'resolve'
-  if args.size != 1
-    puts &quot;Usage: lh-branch resolve 1 [message]&quot;
-    exit
-  end
-  system(&quot;git commit -a -m \&quot;#{args.shift}\n\n[##{ticket_id} state:resolved]\&quot;&quot;)
-end
\ No newline at end of file
+LighthouseBranch.invoke(ARGV)
\ No newline at end of file</diff>
      <filename>bin/lh-branch</filename>
    </modified>
    <modified>
      <diff>@@ -54,7 +54,9 @@ class LighthouseBranch
     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 commit [ticket_id] [message]&quot;
     puts &quot;lh-branch delete [ticket_id]&quot;
-    puts &quot;lh-branch resolve 1 [message]&quot;
+    puts &quot;lh-branch delete_remote [ticket_id] [remote name]&quot;
+    puts &quot;lh-branch resolve [ticket_id] [message]&quot;
   end
 end
\ No newline at end of file</diff>
      <filename>lib/lighthouse_branch.rb</filename>
    </modified>
    <modified>
      <diff>@@ -11,13 +11,25 @@ module Command
       @@commands.merge!(name =&gt; self)
     end
     
+    def self.number_of_arguments(arguments)
+      self.class_eval(&quot;@@number_of_arguments = #{arguments}&quot;)
+    end
+    
+    def self.usage(usage)
+      self.class_eval(&quot;@@usage = \&quot;#{usage}\&quot;&quot;)
+    end
+    
     def self.commands
       return @@commands
     end
     
     def self.run(lighthouse_branch, ticket, args)
       return unless defined?(:command_string)
-      system(self.command_string(lighthouse_branch, ticket, args))
+      unless args.size == (self.class_eval(&quot;@@number_of_arguments&quot;) || 0)
+        puts self.class_eval(&quot;@@usage&quot;) and exit
+      else
+        system(self.command_string(lighthouse_branch, ticket, args))
+      end
     end
     
     def self.command_regexes</diff>
      <filename>lib/lighthouse_branch/command/base.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,9 @@
 module Command
   class Branch &lt; Command::Base
     default_command
+    number_of_arguments 0
+    
+    usage &quot;lh-branch [ticket_id]&quot;
     
     def self.command_string(lighthouse_branch, ticket_id, args)
       &quot;git checkout -b #{lighthouse_branch.branch_name(ticket_id)}&quot;</diff>
      <filename>lib/lighthouse_branch/commands/branch.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,9 @@
 module Command
   class Checkout &lt; Command::Base
     command_name :checkout
+    number_of_arguments 0
+    
+    usage &quot;lh-branch checkout [ticket_id]&quot;
     
     def self.command_string(lighthouse_branch, ticket_id, args)
       &quot;git checkout #{lighthouse_branch.branch_name(ticket_id)}&quot;</diff>
      <filename>lib/lighthouse_branch/commands/checkout.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,9 @@
 module Command
   class Commit &lt; Command::Base
     command_name :commit
+    number_of_arguments 1
+    
+    usage &quot;lh-branch commit [ticket_id] [message]&quot;
     
     def self.command_string(lighthouse_branch, ticket_id, args)
       &quot;git commit -a -m \&quot;#{args.shift}\n\n[##{ticket_id}]\&quot;&quot;</diff>
      <filename>lib/lighthouse_branch/commands/commit.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,9 @@
 module Command
   class Delete &lt; Command::Base
     command_name :delete
+    number_of_arguments 0
+    
+    usage &quot;lh-branch delete [ticket_id]&quot;
     
     def self.command_string(lighthouse_branch, ticket_id, args)
       &quot;git branch -d #{lighthouse_branch.branch_name(ticket_id)}&quot;</diff>
      <filename>lib/lighthouse_branch/commands/delete.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,9 @@
 module Command
   class DeleteRemote &lt; Command::Base
     command_name :delete_remote
+    number_of_arguments 1
+    
+    usage &quot;lh-branch delete_remote [ticket_id] [remote name]&quot;
     
     def self.command_string(lighthouse_branch, ticket_id, args)
       &quot;git push #{args.shift} :#{lighthouse_branch.branch_name(ticket_id)}&quot;</diff>
      <filename>lib/lighthouse_branch/commands/delete_remote.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,9 @@
 module Command
   class Merge &lt; Command::Base
     command_name :merge
+    number_of_arguments 0
+    
+    usage &quot;lh-branch merge [ticket_id]&quot;
     
     def self.command_string(lighthouse_branch, ticket_id, args)
       &quot;git merge #{lighthouse_branch.branch_name(ticket_id)}&quot;</diff>
      <filename>lib/lighthouse_branch/commands/merge.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,9 @@
 module Command
   class Pull &lt; Command::Base
     command_name :pull
+    number_of_arguments 1
+    
+    usage &quot;lh-branch pull [ticket_id] [remote name]&quot;
     
     def self.command_string(lighthouse_branch, ticket_id, args)
       &quot;git pull #{args.shift} #{lighthouse_branch.branch_name(ticket_id)}&quot;</diff>
      <filename>lib/lighthouse_branch/commands/pull.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,9 @@
 module Command
   class Push &lt; Command::Base
     command_name :push
+    number_of_arguments 1
+    
+    usage &quot;lh-branch push [ticket_id] [remote name]&quot;
     
     def self.command_string(lighthouse_branch, ticket_id, args)
       &quot;git push #{args.shift} #{lighthouse_branch.branch_name(ticket_id)}&quot;</diff>
      <filename>lib/lighthouse_branch/commands/push.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,8 @@
 module Command
   class Resolve &lt; Command::Base
     command_name :resolve
+    number_of_arguments 1
+    usage &quot;lh-branch resolve [ticket_id] [message]&quot;
     
     def self.command_string(lighthouse_branch, ticket_id, args)
       &quot;git commit -a -m \&quot;#{args.shift}\n\n[##{ticket_id} state:resolved]\&quot;&quot;</diff>
      <filename>lib/lighthouse_branch/commands/resolve.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>ea7574c741b75678191528d942fcefaaf1b98bcd</id>
    </parent>
  </parents>
  <author>
    <name>Matt Pruitt</name>
    <email>guitsaru@gmail.com</email>
  </author>
  <url>http://github.com/guitsaru/lighthouse_branch/commit/7234f4f48037f7dfc3446788b23408a2cbb51f67</url>
  <id>7234f4f48037f7dfc3446788b23408a2cbb51f67</id>
  <committed-date>2009-06-22T21:23:46-07:00</committed-date>
  <authored-date>2009-06-22T21:23:46-07:00</authored-date>
  <message>Added usage to each command.

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