Skip to content

Commit

Permalink
Add support -v, --verbose option
Browse files Browse the repository at this point in the history
  • Loading branch information
ydah committed Jul 2, 2024
1 parent fd28ccc commit e4b4e70
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/lrama/option_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def parse_by_option_parser(argv)
o.on_tail ' time display generation time'
o.on_tail ' all include all the above traces'
o.on_tail ' none disable all traces'
o.on('-v', 'reserved, do nothing') { }
o.on('-v', '--verbose', "same as '--report=state'") {|_v| @report << 'states' }
o.separator ''
o.separator 'Diagnostics:'
o.on('-W', '--warnings', 'report the warnings') {|v| @options.diagnostic = true }
Expand Down
16 changes: 15 additions & 1 deletion spec/lrama/option_parser_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
--report-file=FILE also produce details on the automaton output to a file named FILE
-o, --output=FILE leave output to FILE
--trace=TRACES also output trace logs at runtime
-v reserved, do nothing
-v, --verbose same as '--report=state'
Diagnostics:
-W, --warnings report the warnings
Expand Down Expand Up @@ -143,6 +143,20 @@
expect { option_parser.send(:validate_report, ["invalid"]) }.to raise_error(/Invalid report option/)
end
end

context "when -v option is passed" do
it "returns option hash states flag enabled" do
opts = option_parser.send(:validate_report, ["states"])
expect(opts).to eq({grammar: true, states: true})
end
end

context "when --verbose option is passed" do
it "returns option hash states flag enabled" do
opts = option_parser.send(:validate_report, ["states"])
expect(opts).to eq({grammar: true, states: true})
end
end
end

describe "#validate_trace" do
Expand Down

0 comments on commit e4b4e70

Please sign in to comment.