Skip to content

Commit bee4b2a

Browse files
committed
fix(tests): update help and --out handling to support formats or file
1 parent 43bf3a7 commit bee4b2a

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

lib/skunk/cli/options/argv.rb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ def parse
2323
self.mode = :compare_branches
2424
end
2525

26-
opts.on("-o", "--out console,json,html", Array, "Output formats") do |formats|
27-
Skunk::Config.formats = formats.map(&:to_sym)
28-
end
29-
30-
opts.on("--out-file FILE", "Output report to file") do |filename|
31-
self.output_filename = filename
26+
opts.on("-o", "--out console,json,html", Array, "Output formats or file") do |values|
27+
if values.all? { |v| Skunk::Config.supported_format?(v.to_sym) }
28+
Skunk::Config.formats = values.map(&:to_sym)
29+
else
30+
self.output_filename = values.join(",")
31+
end
3232
end
3333

3434
opts.on_tail("-v", "--version", "Show gem's version") do

test/lib/skunk/application_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
end
4747

4848
context "when passing an environment variable SHARE=true" do
49-
let(:argv) { ["--out-file=tmp/shared_report.txt", "samples/rubycritic"] }
49+
let(:argv) { ["--out=tmp/shared_report.txt", "samples/rubycritic"] }
5050
let(:success_code) { 0 }
5151
let(:shared_message) do
5252
"Shared at: https://skunk.fastruby.io/j"

test/lib/skunk/commands/help_test.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
<<~HELP
1212
Usage: skunk [options] [paths]
1313
-b, --branch BRANCH Set branch to compare
14-
-o, --out console,json,html Output formats
15-
--out-file FILE Output report to file
14+
-o, --out console,json,html Output formats or file
1615
-v, --version Show gem's version
1716
-h, --help Show this message
1817
HELP

0 commit comments

Comments
 (0)