18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
# File 'lib/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
format = prompt.select('What output format do you want?', %w[Detail CSV])
types = prompt.multi_select(
'What violation types do you want stats for?',
%w[Privacy Dependency Layer]
)
include_date = !prompt.no?('Should the current date be included in the report?')
puts "You've selected #{selected_packs.count} packs. Wow! Here's all the info."
Private.get_info(
packs: selected_packs,
format: format.downcase.to_sym,
types: types.map(&:downcase).map(&:to_sym),
include_date: include_date
)
end
|