diff options
| author | mo khan <mo.khan@gmail.com> | 2020-11-18 16:40:47 -0700 |
|---|---|---|
| committer | mo khan <mo.khan@gmail.com> | 2020-11-18 16:40:47 -0700 |
| commit | 8fbf907eed52c36970c1d911d4acfeba76bb3aee (patch) | |
| tree | 615ed8911191ed3217b911d4f4415385e6a8e344 /lib | |
| parent | 71a2da682ca1a3531c237e8eadb5735dc6b34542 (diff) | |
feat: improve spinner formatting
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/spandx/cli/commands/pull.rb | 2 | ||||
| -rw-r--r-- | lib/spandx/cli/printers/table.rb | 7 |
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/spandx/cli/commands/pull.rb b/lib/spandx/cli/commands/pull.rb index ebf4618..bcff1b0 100644 --- a/lib/spandx/cli/commands/pull.rb +++ b/lib/spandx/cli/commands/pull.rb @@ -37,7 +37,7 @@ module Spandx end def with_spinner(message, output:) - spinner = TTY::Spinner.new("[:spinner] #{message}", clear: false, output: output) + spinner = TTY::Spinner.new("[:spinner] #{message}", output: output) spinner.auto_spin yield spinner.success('(done)') diff --git a/lib/spandx/cli/printers/table.rb b/lib/spandx/cli/printers/table.rb index 931b739..e9672e8 100644 --- a/lib/spandx/cli/printers/table.rb +++ b/lib/spandx/cli/printers/table.rb @@ -6,8 +6,9 @@ module Spandx 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) @@ -16,7 +17,6 @@ module Spandx def print_header(_io) @dependencies = SortedSet.new - @spinner.auto_spin end def print_line(dependency, _io) @@ -25,6 +25,7 @@ module Spandx def print_footer(io) @spinner.stop + @spinner.reset io.puts(to_table(@dependencies.map(&:to_a))) end |
