Sha256: 7ed697666b042bba35f19971582999c6b9feef8058f3874bed34b7ddf8500e96

Contents?: true

Size: 573 Bytes

Versions: 4

Compression:

Stored size: 573 Bytes

Contents

# frozen_string_literal: true

module Senrigan
  class CLI
    def initialize(argv)
      @argv = argv.clone
    end

    def run!
      clear_terminal
      show_header
      formatter = Senrigan::Formatter.new
      adapter = Senrigan::Adapter.new
      adapter.on do |entity|
        formatter.format_print(entity)
      end
      adapter.connect!
    rescue Interrupt
      exit 0
    end

    private

    def clear_terminal
      print "\e[H\e[2J"
    end

    def show_header
      STDOUT.puts "[Senrigan v.#{Senrigan::VERSION}]"
      STDOUT.puts
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
senrigan-0.2.0 lib/senrigan/cli.rb
senrigan-0.1.2 lib/senrigan/cli.rb
senrigan-0.1.1 lib/senrigan/cli.rb
senrigan-0.1.0 lib/senrigan/cli.rb