<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>.gitignore</filename>
    </added>
    <added>
      <filename>PostInstall.txt</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,25 +1,19 @@
+bin/git-lh
+config/hoe.rb
+config/requirements.rb
 History.txt
+lib/git-lighthouse
+lib/git-lighthouse/base.rb
+lib/git-lighthouse/cli.rb
+lib/git-lighthouse/lighthouse.rb
+lib/git-lighthouse/version.rb
+lib/git-lighthouse.rb
 License.txt
 Manifest.txt
 PostInstall.txt
-README.txt
 Rakefile
-config/hoe.rb
-config/requirements.rb
-lib/git-lh.rb
-lib/git-lh/version.rb
-script/console
-script/destroy
-script/generate
-script/txt2html
+README.txt
 setup.rb
-tasks/deployment.rake
-tasks/environment.rake
-tasks/website.rake
-test/test_git-lh.rb
-test/test_helper.rb
-website/index.html
-website/index.txt
-website/javascripts/rounded_corners_lite.inc.js
-website/stylesheets/screen.css
-website/template.html.erb
+spec/cli_spec.rb
+spec/spec_helper.rb
+TODO.txt</diff>
      <filename>Manifest.txt</filename>
    </modified>
    <modified>
      <diff>@@ -19,6 +19,7 @@ module GitLighthouse
       Lighthouse.password = @password if @password
     end
 
+    
     def get_project
       Lighthouse::Project.find(@projectId)
     end
@@ -48,5 +49,20 @@ module GitLighthouse
       return false    
     end
     
+    
+    def get_attachment_data(tid, attId)
+      output = ''
+      if tic = get_ticket(tid)
+        doc = Hpricot(open(get_url(tic)))
+        urls = []
+        (doc/&quot;ul.attachments&quot;/:li/:ins/:h4/:a).each do |t| 
+          urls &lt;&lt; @lh_url + t['href']
+        end      
+        idx = ((urls.size &gt; 1) &amp;&amp; (attId)) ? attId.to_i - 1 : 0
+        output = open(urls[idx]).read if urls[idx]
+      end
+      output
+    end
+    
   end
 end
\ No newline at end of file</diff>
      <filename>lib/git-lighthouse/base.rb</filename>
    </modified>
    <modified>
      <diff>@@ -29,12 +29,14 @@ module GitLighthouse
         handle_ticket_list
       when 'show'
         handle_ticket_show
+      when 'comments'
+        handle_ticket_comments
       when 'checkout', 'co'
         handle_ticket_checkout
-      when 'apply'
-        handle_ticket_apply
       when 'attachment'
         handle_ticket_attachment
+      when 'apply'
+        handle_ticket_apply
       when 'comment'
         handle_ticket_comment
       when 'recent'
@@ -65,8 +67,8 @@ module GitLighthouse
     end
     
     def handle_ticket_checkout
-      #tid = ARGV[1].chomp
-      #tic.ticket_checkout(tid)
+      tid = ARGV[1].chomp
+      @lh.ticket_checkout(tid)
     end
         
     ## LIST TICKETS ##
@@ -135,35 +137,33 @@ module GitLighthouse
       end
     end
     
+    # outputs actual patch file
+    def handle_ticket_attachment
+      tid = ARGV[1].chomp
+      attId = ARGV[2].chomp
+      puts @lh.get_attachment_data(tid, attId)
+    end
+    
     # outputs actual patch file, include ID=XX 
     # (and optionally NUMBER=XX if more than 1)
     def handle_ticket_attachment
       tid = ARGV[1].chomp
-      attId = ARGV[1].chomp
-
-      if tic = @lh.get_ticket(tid)
-        doc = Hpricot(open(@lh.get_url(tic)))
-        urls = []
-        (doc/&quot;ul.attachments&quot;/:li/:ins/:h4/:a).each do |t| 
-          urls &lt;&lt; @lh.lh_url + t['href']
-        end      
-        idx = ((urls.size &gt; 1) &amp;&amp; (attId)) ? attId.to_i - 1 : 0
-        puts open(urls[idx]).read if urls[idx]
-      end
+      attId = ARGV[2].chomp
+      puts @lh.get_attachment_data(tid, attId)
     end
     
-    
-    def show_comments
-      setup_env
-
-      if tic = get_ticket(ENV['ID'])     
+    def handle_ticket_comments
+      tid = ARGV[1].chomp
+      if tic = @lh.get_ticket(tid)
+        tic_url = @lh.get_url(tic)     
         puts 
         puts 'Title   : ' + tic.title
+        puts 'URL     : ' + tic_url        
         puts
         puts '-- Comments --'
         puts
 
-        doc = Hpricot(open(get_xml_url(ENV['ID'])))
+        doc = Hpricot(open(@lh.get_xml_url(tid)))
         (doc/&quot;versions &gt; version&quot;).each do |comment|
           #puts (comment/'updated-at').first.inner_html rescue nil
           puts word_wrap((comment/:body).inner_html) rescue nil
@@ -245,8 +245,9 @@ module GitLighthouse
         warn &quot;Please specify at least one action to execute:&quot;
         puts &quot;  list - list patch tickets in lighthouse&quot;
         puts &quot;  show (id) - show ticket detail &quot;
+        puts &quot;  comments (id) - shows all comments on this ticket&quot;
         puts &quot;  attachment (ticket_id) [attachment number] - output patch to stdout&quot;
-        #puts &quot;  checkout (id) - create a new branch and apply ticket to it&quot;
+        puts &quot;  checkout (id) - create a new branch and apply ticket to it&quot;
         #puts &quot;  apply (id) - apply ticket to current branch&quot;
         #puts &quot;  push (id) - create new patch file and push to ticket&quot;
         #puts &quot;  comment (id) - add comment to ticket&quot;</diff>
      <filename>lib/git-lighthouse/cli.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>5ee25b3056b91e27f43efc8730dfa744a9cce900</id>
    </parent>
  </parents>
  <author>
    <name>Scott Chacon</name>
    <email>schacon@gmail.com</email>
  </author>
  <url>http://github.com/schacon/git-lighthouse/commit/49b9d740e2300d8bdfba5674d5418840b6807099</url>
  <id>49b9d740e2300d8bdfba5674d5418840b6807099</id>
  <committed-date>2008-05-27T11:08:08-07:00</committed-date>
  <authored-date>2008-05-27T11:08:08-07:00</authored-date>
  <message>added comment viewing for a ticket</message>
  <tree>208801f54d97a1915430ae4ba19a6af4d31b1543</tree>
  <committer>
    <name>Scott Chacon</name>
    <email>schacon@gmail.com</email>
  </committer>
</commit>
