Class: BundleOutdatedFormatter::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/bundle_outdated_formatter/cli.rb

Overview

Command-line interface of BundleOutdatedFormatter

Constant Summary collapse

FORMATTERS =
{
  'terminal' => TerminalFormatter,
  'markdown' => MarkdownFormatter,
  'json'     => JSONFormatter,
  'yaml'     => YAMLFormatter,
  'csv'      => CSVFormatter,
  'tsv'      => TSVFormatter,
  'xml'      => XMLFormatter,
  'html'     => HTMLFormatter
}.freeze
STYLES =
%w[unicode ascii].freeze
COLUMNS =
%w[gem newest installed requested groups].freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/bundle_outdated_formatter/cli.rb', line 28

def self.exit_on_failure?
  false
end

Instance Method Details

#outputObject



40
41
42
43
44
45
46
47
48
49
# 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

#versionObject



54
55
56
# File 'lib/bundle_outdated_formatter/cli.rb', line 54

def version
  puts "bundle_outdated_formatter #{BundleOutdatedFormatter::VERSION}"
end