Sha256: b5d61c8ffccd3a90a0086cbc8cd742b4ee63d7c8d2d1d7a6ace0a64b04ac46a5

Contents?: true

Size: 727 Bytes

Versions: 14

Compression:

Stored size: 727 Bytes

Contents

require 'thor'

module FindbugsTranslateCheckstyleFormat
  class CLI < Thor
    include ::FindbugsTranslateCheckstyleFormat::Translate
    desc 'translate', 'Exec Translate'
    option :data
    option :file
    def translate
      data = fetch_data(options)
      xml = parse(data)
      checkstyle = trans(xml)
      checkstyle.write(STDOUT, 2)
    end

    no_commands do
      def fetch_data(options)
        data = \
          if options[:data]
            options[:data]
          elsif options[:file]
            File.read(options[:file])
          elsif !$stdin.tty?
            ARGV.clear
            ARGF.read
          end

        fail NoInputError if !data || data.empty?

        data
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
findbugs_translate_checkstyle_format-0.3.0 lib/findbugs_translate_checkstyle_format/cli.rb
findbugs_translate_checkstyle_format-0.2.6 lib/findbugs_translate_checkstyle_format/cli.rb
findbugs_translate_checkstyle_format-0.2.5 lib/findbugs_translate_checkstyle_format/cli.rb
findbugs_translate_checkstyle_format-0.2.4 lib/findbugs_translate_checkstyle_format/cli.rb
findbugs_translate_checkstyle_format-0.2.3 lib/findbugs_translate_checkstyle_format/cli.rb
findbugs_translate_checkstyle_format-0.2.2 lib/findbugs_translate_checkstyle_format/cli.rb
findbugs_translate_checkstyle_format-0.2.1 lib/findbugs_translate_checkstyle_format/cli.rb
findbugs_translate_checkstyle_format-0.2.0 lib/findbugs_translate_checkstyle_format/cli.rb
findbugs_translate_checkstyle_format-0.1.6 lib/findbugs_translate_checkstyle_format/cli.rb
findbugs_translate_checkstyle_format-0.1.5 lib/findbugs_translate_checkstyle_format/cli.rb
findbugs_translate_checkstyle_format-0.1.4 lib/findbugs_translate_checkstyle_format/cli.rb
findbugs_translate_checkstyle_format-0.1.2 lib/findbugs_translate_checkstyle_format/cli.rb
findbugs_translate_checkstyle_format-0.1.1 lib/findbugs_translate_checkstyle_format/cli.rb
findbugs_translate_checkstyle_format-0.1.0 lib/findbugs_translate_checkstyle_format/cli.rb