Class: UsePacks::Private::InteractiveCli::UseCases::GetInfo

Inherits:
Object
  • Object
show all
Extended by:
T::Helpers, T::Sig
Includes:
Interface
Defined in:
lib/use_packs/private/interactive_cli/use_cases/get_info.rb

Instance Method Summary collapse

Methods included from Interface

all, included

Instance Method Details

#perform!(prompt) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/use_packs/private/interactive_cli/use_cases/get_info.rb', line 18

def perform!(prompt)
  team_or_pack = prompt.select('Do you want info by team or by pack?', ['By team', 'By pack'])
  if team_or_pack == 'By team'
    teams = TeamSelector.multi_select(prompt)
    selected_packs = Packs.all.select do |p|
      teams.map(&:name).include?(CodeOwnership.for_package(p)&.name)
    end
  else
    selected_packs = PackSelector.single_or_all_pack_multi_select(prompt, question_text: 'What pack(s) would you like info on?')
  end

  puts "You've selected #{selected_packs.count} packs. Wow! Here's all the info."

  Private.get_info(packs: selected_packs)
end

#user_facing_nameObject



13
14
15
# File 'lib/use_packs/private/interactive_cli/use_cases/get_info.rb', line 13

def user_facing_name
  'Get info on one or more packs'
end