Skip to content

Commit

Permalink
Finish 2.2.8
Browse files Browse the repository at this point in the history
  • Loading branch information
gkellogg committed Aug 17, 2017
2 parents 350df1f + 5f1d075 commit d7add8d
Show file tree
Hide file tree
Showing 7 changed files with 491 additions and 263 deletions.
2 changes: 1 addition & 1 deletion VERSION
@@ -1 +1 @@
2.2.7
2.2.8
34 changes: 15 additions & 19 deletions bin/rdf
Expand Up @@ -3,28 +3,24 @@ $:.unshift(File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib')))
require 'rubygems'
require 'rdf/cli'

options = RDF::CLI.options do
self.on('-v', '--verbose', 'Enable verbose output. May be given more than once.') do
self.options[:logger].level = Logger::INFO
end
options = RDF::CLI.options(ARGV)

self.on('-V', '--version', 'Display the RDF.rb version and exit.') do
puts RDF::VERSION; exit
end
abort options.banner if ARGV.empty? && !options.options[:evaluate]

# Add option_parser to parsed options to enable help
begin
messages = {}
RDF::CLI.exec(options.args, option_parser: options, **options.options.merge(messages: messages))

ARGV.select {|a| RDF::CLI.commands.include?(a)}.each do |cmd|
# Load command-specific options
Array(RDF::CLI::COMMANDS[cmd.to_sym][:options]).each do |cli_opt|
on_args = cli_opt.on || []
on_args << cli_opt.description if cli_opt.description
self.on(*on_args) do |arg|
self.options[cli_opt.symbol] = cli_opt.call(arg)
unless messages.empty?
$stdout.puts "Messages:"
messages.each do |kind, term_messages|
term_messages.each do |term, messages|
$stdout.puts "#{kind} #{term}"
messages.each {|m| $stdout.puts " #{m}"}
end
end
end
rescue ArgumentError => e
RDF::CLI.abort e.message
end

abort options.banner if ARGV.empty? && !options.options[:evaluate]

# Add option_parser to parsed options to enable help
RDF::CLI.exec(ARGV, options.options.merge(option_parser: options))

0 comments on commit d7add8d

Please sign in to comment.