Method: PGit::Project::InteractiveAdder#get_projects

Defined in:
lib/pgit/project/interactive_adder.rb

#get_projectsObject



25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/pgit/project/interactive_adder.rb', line 25

def get_projects
  projects = PGit::Pivotal::Projects.new(api_token: project.api_token).get!
  question = Interactive::Question.new do |q|
    q.question = "Which project do you want to associate with the working directory?"
    q.options = [projects]
    q.columns = [:index, :name]
  end

  question.ask do |response|
    if response.whole_number?
      project.id = projects[response.to_i].id
    end
  end
end