Skip to content

Commit 6b74365

Browse files
committed
Do some sanity normalization of CLI output messages hash.
1 parent 9a0d9b4 commit 6b74365

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

lib/rdf/cli.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,17 @@ def self.exec(args, output: $stdout, option_parser: nil, messages: {}, **options
507507
COMMANDS[command.to_sym][:lambda].call(args, output: output, **options.merge(messages: messages))
508508
end
509509

510+
# Normalize messages
511+
messages.each do |kind, term_messages|
512+
case term_messages
513+
when Hash
514+
when Array
515+
messages[kind] = {result: term_messages}
516+
else
517+
messages[kind] = {result: [term_messages]}
518+
end
519+
end
520+
510521
if options[:statistics]
511522
options[:statistics][:reader] = @readers.first unless (@readers || []).empty?
512523
options[:statistics][:count] = @repository.count

0 commit comments

Comments
 (0)