Skip to content

Commit 633f011

Browse files
committed
fix(cli): update help text to show default output format
Add test case to verify default console format when no --formats option is provided
1 parent 5e6896d commit 633f011

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

lib/skunk/cli/options/argv.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def parse
2727
self.output_filename = filename
2828
end
2929

30-
opts.on("-f", "--formats json,html,console", Array, "Output formats: json,html,console") do |list|
30+
opts.on("-f", "--formats json,html,console", Array, "Output formats: json,html,console (default: console)") do |list|
3131
Skunk::Config.formats = Array(list).map(&:to_sym)
3232
end
3333

test/lib/skunk/cli/options/argv_test.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
after do
3030
Skunk::Config.reset
3131
end
32+
3233
context "passing --formats option" do
3334
let(:argv) { ["--formats=json,html"] }
3435

@@ -38,5 +39,13 @@
3839
_(Skunk::Config.formats).must_equal %i[json html]
3940
end
4041
end
42+
43+
context "not passing --formats option" do
44+
it "defaults to console format" do
45+
parser = Skunk::Cli::Options::Argv.new([])
46+
parser.parse
47+
_(Skunk::Config.formats).must_equal [:console]
48+
end
49+
end
4150
end
4251
end

test/lib/skunk/commands/help_test.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
Usage: skunk [options] [paths]
1313
-b, --branch BRANCH Set branch to compare
1414
-o, --out FILE Output report to file
15-
-f, --formats json,html,console Output formats: json,html,console
15+
-f, --formats json,html,console Output formats: json,html,console (default: console)
1616
-v, --version Show gem's version
1717
-h, --help Show this message
1818
HELP

0 commit comments

Comments
 (0)