Module: PDK::CLI::Util::UpdateManagerPrinter

Defined in:
lib/pdk/cli/util/update_manager_printer.rb

Class Method Summary collapse

Class Method Details

This method returns an undefined value.

Prints the summary for a PDK::Module::UpdateManager Object

Parameters:

  • update_manager (PDK::Module::UpdateManager)

    The object to print a summary of

  • options (Hash{Object => Object}) (defaults to: {})

    A list of options when printing

Options Hash (options):

  • :tense (Boolean)

    Whether to use future (:future) or past (:past) tense when printing the summary (“Files to be added” versus “Files added”). Default is :future



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/pdk/cli/util/update_manager_printer.rb', line 13

def self.print_summary(update_manager, options = {})
  require 'pdk/report'

  options = {
    tense: :future
  }.merge(options)

  footer = false

  summary(update_manager).each do |category, files|
    next if files.empty?

    PDK::Report.default_target.puts('')
    PDK::Report.default_target.puts(generate_banner("Files #{options[:tense] == :future ? 'to be ' : ''}#{category}", 40))
    PDK::Report.default_target.puts(files.map(&:to_s).join("\n"))
    footer = true
  end

  if footer # rubocop:disable Style/GuardClause No.
    PDK::Report.default_target.puts('')
    PDK::Report.default_target.puts(generate_banner('', 40))
  end
end