Class: Helm::Commands::List

Inherits:
Command
  • Object
show all
Defined in:
lib/helm/commands/list.rb

Instance Attribute Summary

Attributes inherited from Command

#session

Instance Method Summary collapse

Methods inherited from Command

#cache, #initialize, #parameters

Constructor Details

This class inherits a constructor from Helm::Commands::Command

Instance Method Details

#find_user(id) ⇒ Object



17
18
19
20
# File 'lib/helm/commands/list.rb', line 17

def find_user(id)
  user_id = "user-%s" % id
  cache.get(user_id) || cache.set(user_id, session.user(id))
end

#runObject



4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/helm/commands/list.rb', line 4

def run
  parameters :filter

  filter = session[:filter] || "responsible:me state:open milestone:next"

  puts "Tickets with filter \"#{filter}\""
  session.tickets(filter).each do |ticket|
    assignee = ticket.assigned_user_id ?
      find_user(ticket.assigned_user_id).name : "Unassigned"
    puts "  ##{ticket.id} #{ticket.title} (#{assignee})"
  end
end