lib/spandx/cli/printers/table.rb in spandx-0.15.0 vs lib/spandx/cli/printers/table.rb in spandx-0.15.1
- old
+ new
@@ -4,28 +4,29 @@
module Cli
module Printers
class Table < Printer
HEADINGS = ['Name', 'Version', 'Licenses', 'Location'].freeze
- def initialize
- @spinner = TTY::Spinner.new(output: $stderr)
+ def initialize(output: $stderr)
+ @spinner = TTY::Spinner.new('[:spinner] Scanning...', output: output, clear: true, format: :dots)
+ @spinner.auto_spin
end
def match?(format)
format.to_sym == :table
end
def print_header(_io)
@dependencies = SortedSet.new
- @spinner.auto_spin
end
def print_line(dependency, _io)
@dependencies << dependency
end
def print_footer(io)
@spinner.stop
+ @spinner.reset
io.puts(to_table(@dependencies.map(&:to_a)))
end
private