class BundleOutdatedFormatter::CLI

Command-line interface of {BundleOutdatedFormatter}

Constants

COLUMNS
FORMATTERS
STYLES

Public Class Methods

exit_on_failure?() click to toggle source
# File lib/bundle_outdated_formatter/cli.rb, line 28
def self.exit_on_failure?
  false
end

Public Instance Methods

output() click to toggle source
# File lib/bundle_outdated_formatter/cli.rb, line 40
def output
  raise BundleOutdatedFormatter::UnknownFormatError, options[:format] unless allow_format?
  raise BundleOutdatedFormatter::UnknownStyleError, options[:style] unless allow_style?
  raise BundleOutdatedFormatter::UnknownColumnError, options[:column] unless allow_column?
  return if STDIN.tty?

  formatter = create_formatter
  formatter.read_stdin
  puts formatter.convert
end
version() click to toggle source
# File lib/bundle_outdated_formatter/cli.rb, line 54
def version
  puts "bundle_outdated_formatter #{BundleOutdatedFormatter::VERSION}"
end

Private Instance Methods

allow_column?() click to toggle source
# File lib/bundle_outdated_formatter/cli.rb, line 68
def allow_column?
  options[:column].all? do |column|
    COLUMNS.include?(column)
  end
end
allow_format?() click to toggle source
# File lib/bundle_outdated_formatter/cli.rb, line 60
def allow_format?
  FORMATTERS.key?(options[:format])
end
allow_style?() click to toggle source
# File lib/bundle_outdated_formatter/cli.rb, line 64
def allow_style?
  STYLES.include?(options[:style])
end
create_formatter() click to toggle source
# File lib/bundle_outdated_formatter/cli.rb, line 74
def create_formatter
  FORMATTERS[options[:format]].new(options)
end