26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/text_to_checkstyle/cli.rb', line 26
def convert
setup_logger(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?
params = {
name: options[:name],
line: options[:line],
column: options[:column],
severity: options[:severity],
source: options[:source]
}
puts ::TextToCheckstyle::Converter.convert(data, params)
rescue StandardError => e
suggest_messages(options)
raise e
end
|