git-pivotal icon indicating copy to clipboard operation
git-pivotal copied to clipboard

Viewing all tasks associated with a story when using 'git info'

Open brenzenb opened this issue 14 years ago • 2 comments

Is there a way to view all of the story-level tasks when calling 'git info' ?

If I have a story created in Pivotal with 5 tasks, I'd like to be able to see a list of these stories when calling 'git info'. I'd love to also be able to mark a task as complete from the command line tool, but that less of a priority for me.

brenzenb avatar Nov 28 '11 17:11 brenzenb

After playing around a bit, I was able to manipulate the 'git info' output via the 'info.rb' file. I successfully added in label information, but the API call for a Story's task isn't returning actual tasks. Here's the new code:

require 'commands/base'

module Commands
  class Info < Base

    def run!
      super

      unless story_id
        put "Branch name must contain a Pivotal Tracker story id"
        return 1
      end

      put "Story:         #{story.name}"
      put "URL:           #{story.url}"
      put "Labels:        #{story.labels}"
      put "Description:   #{story.description}"
      put "Tasks:         #{story.tasks}"    
      return 0
    end

 protected

    def story_id
      current_branch[/\d+/].to_i
    end

    def story
      @story ||= project.stories.find(story_id)
    end
  end
end

And the output ends up looking like this:

Story: This is a generic story title URL: http://www.pivotaltracker.com/story/show/123456789 Labels: testing, qa Description: Examine a test story using git-pivotal

Tasks: PivotalTracker::Task

Anyone know why the {story.tasks} reference only outputs "PivotalTracker::Task"? The story I'm referencing has two separate tasks.

brenzenb avatar Nov 28 '11 18:11 brenzenb

try this.. https://gist.github.com/1725163

this is a great idea.. can you put it in a pull request?

addynaik avatar Feb 02 '12 19:02 addynaik