Skip to content

Commit 247cba7

Browse files
committed
Make sure CLI logger is set in options, using that from option_parser if not provided explicitly.
1 parent c0afbdb commit 247cba7

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

lib/rdf/cli.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ def self.usage(options, cmd_opts = {}, banner: nil)
441441
# @return [Boolean]
442442
def self.exec(args, output: $stdout, option_parser: nil, **options)
443443
option_parser ||= self.options(args)
444+
options[:logger] ||= option_parser.options[:logger]
444445
output.set_encoding(Encoding::UTF_8) if output.respond_to?(:set_encoding) && RUBY_PLATFORM == "java"
445446

446447
# Separate commands from file options; arguments already extracted

spec/cli_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
describe "options" do
1717
it "sets debug logging with --debug" do
1818
options = RDF::CLI.options(%w(help --debug))
19-
expect(options.options[:logger].level).to eql Logger::DEBUG
19+
expect(options.options[:debug]).to be_truthy
2020
end
2121

2222
it "extracts non-option arguments into options.args" do

0 commit comments

Comments
 (0)