File: progress.rb

package info (click to toggle)
ruby-tty-command 0.10.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 452 kB
  • sloc: ruby: 1,990; makefile: 4; sh: 4
file content (27 lines) | stat: -rw-r--r-- 543 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
require_relative "abstract"

module TTY
  class Command
    module Printers
      class Progress < Abstract
        def print_command_exit(cmd, status, runtime, *args)
          output.print(success_or_failure(status))
        end

        def write(*)
        end

        private

        # @api private
        def success_or_failure(status)
          if status == 0
            decorate(".", :green)
          else
            decorate("F", :red)
          end
        end
      end # Progress
    end # Printers
  end # Command
end # TTY