Sha256: 51359c5b7a8f39cf9fedd018e16dfdd471ee54d6686d267eeea36247479b5942

Contents?: true

Size: 900 Bytes

Versions: 2

Compression:

Stored size: 900 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]

RDF::CLI.exec(ARGV, options.options)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rdf-2.0.0 bin/rdf
rdf-2.0.0.beta2 bin/rdf