Skip to content

Commit c9f42db

Browse files
committed
Refactor application code
1 parent 9ed7593 commit c9f42db

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

lib/skunk/cli/application.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ def execute
2323

2424
parsed_options = @options.parse.to_h
2525
reporter = Skunk::Cli::CommandFactory.create(parsed_options).execute
26+
27+
@parsed_options = @options.parse.to_h
28+
reporter = Skunk::Cli::CommandFactory.create(@parsed_options).execute
29+
2630
print(reporter.status_message)
2731
reporter.status
2832
rescue OptionParser::InvalidOption => error
@@ -38,7 +42,12 @@ def warn_coverage_info
3842
end
3943

4044
def print(message)
41-
@options.output_stream.puts message
45+
filename = @parsed_options[:output_filename]
46+
if filename.nil?
47+
$stdout.puts(message)
48+
else
49+
File.open(filename, "w") { |f| f.puts(message) }
50+
end
4251
end
4352
end
4453
end

0 commit comments

Comments
 (0)