38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/crossplane/cli.rb', line 38
def parse(filename)
payload = CrossPlane::Parser.new(
filename: filename,
combine: options['combine'] || false,
strict: options['strict'] || false,
catch_errors: options['no_catch'] ? false : true,
comments: options['include_comments'] || false,
ignore: options['ignore'] ? options['ignore'].split(/\s*,\s*/) : [],
single: options['single'] || false,
).parse()
if options['out']
File.open(options['out'], 'w') do |f|
f.write(JSON.pretty_generate(payload))
end
else
puts options['pretty'] ? JSON.pretty_generate(payload) : payload.to_json
end
exit 0
end
|