Sha256: 78786ab299c81e0821957a0a4eae90ab3ce8ecce21df5acba9037b0a086f288b

Contents?: true

Size: 983 Bytes

Versions: 12

Compression:

Stored size: 983 Bytes

Contents

#!/usr/bin/env ruby
$:.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

  self.on('-V', '--version', 'Display the RDF.rb version and exit.') do
    puts RDF::VERSION; exit
  end

  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)
      end
    end
  end
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))

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rdf-2.2.7 bin/rdf
rdf-2.2.6 bin/rdf
rdf-2.2.5 bin/rdf
rdf-2.2.4 bin/rdf
rdf-2.2.3 bin/rdf
rdf-2.2.1 bin/rdf
rdf-2.2.0 bin/rdf
rdf-2.2.0.pre.rc1 bin/rdf
rdf-2.1.1 bin/rdf
rdf-2.1.0 bin/rdf
rdf-2.0.2 bin/rdf
rdf-2.0.1 bin/rdf