Class: Terjira::SprintCLI

Inherits:
BaseCLI
  • Object
show all
Defined in:
lib/terjira/sprint_cli.rb

Overview

CLI for Sprints

Constant Summary

Constants included from IssuePresenter

IssuePresenter::COMMENTS_SIZE

Constants included from OptionSupportable

OptionSupportable::OPTION_TO_SELECTOR

Instance Method Summary collapse

Methods inherited from BaseCLI

banner, subcommand_prefix

Methods included from SprintPresenter

#colorize_sprint_state, #render_sprint_detail, #render_sprints_summary, #sort_sprint_by_state, #summarise_sprint

Methods included from BoardPresenter

#render_boards_summary

Methods included from ProjectPresenter

#redner_project_detail, #render_components_and_versions, #render_projects_summary

Methods included from IssuePresenter

#comments_template, #issue_detail_template, #render_divided_issues_by_status, #render_issue_detail, #render_issues, #summarise_issue

Methods included from CommonPresenter

#dim_none, #formatted_date, #insert_new_line, #pastel, #render, #screen_width, #username

Methods included from OptionSupportable

included, #resource_store, #suggest_options, #suggest_related_value_options

Instance Method Details

#activeObject



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/terjira/sprint_cli.rb', line 27

def active
  opts = suggest_options(required: [:board])
  board = opts[:board]

  sprints = client_class.find_active(board)

  opts[:assignee] ||= current_username

  sprints.each do |sprint|
    issues = Client::Issue.all(opts.merge(sprint: sprint))
    render_sprint_with_issues(sprint, issues)
  end
end

#listObject



44
45
46
47
48
49
50
# File 'lib/terjira/sprint_cli.rb', line 44

def list
  opts = suggest_options(required: [:board])

  state = opts['state'].join(',') if opts['state']
  sprints = client_class.all(opts[:board], state: state)
  render_sprints_summary sprints
end

#show(sprint = nil) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/terjira/sprint_cli.rb', line 16

def show(sprint = nil)
  opts = suggest_options(required: [:sprint], resources: { sprint: sprint })
  sprint = client_class.find(opts[:sprint])
  opts[:assignee] ||= current_username

  issues = Client::Issue.all(opts.merge(sprint: sprint))
  render_sprint_with_issues(sprint, issues)
end