Skip to content

Commit ad47093

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 ad47093

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
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

0 commit comments

Comments
 (0)