Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed a regression bug in the `rdf` command-line utility.

  • Loading branch information...
commit 31b6934f127c6175ef709e243ae5cfec5bdab544 1 parent 6cb76f0
@bendiken bendiken authored
Showing with 9 additions and 9 deletions.
  1. +1 −1  bin/rdf
  2. +8 −8 lib/rdf/cli.rb
View
2  bin/rdf
@@ -13,6 +13,6 @@ options = RDF::CLI.options do
end
end
-abort options.banner if ARGV.empty? && !options.has_key?(:evaluate)
+abort options.banner if ARGV.empty? && !options.options[:evaluate]
RDF::CLI.exec_command(command = ARGV.shift, ARGV, options.options)
View
16 lib/rdf/cli.rb
@@ -16,7 +16,7 @@ def options=(value); @options = value; end
module RDF
class CLI
-
+
COMMANDS = {
"count" => lambda do |argv, opts|
start = Time.new
@@ -69,7 +69,7 @@ class CLI
end
end
}
-
+
##
# @return [String]
def self.basename() File.basename($0) end
@@ -137,13 +137,13 @@ def self.options(&block)
$stdout.puts "Available commands:\n\t#{self.commands.join("\n\t")}"
exit
end
-
+
begin
options.parse!
rescue OptionParser::InvalidOption => e
abort e
end
-
+
options
end
@@ -155,10 +155,10 @@ def self.exec_command(command, args, options = {})
unless COMMANDS.has_key?(command)
abort "#{File.basename($0)}: unknown command `#{command}'"
end
-
+
COMMANDS[command].call(args, options)
end
-
+
##
# @return [Array<String>] list of executable commands
def self.commands
@@ -173,7 +173,7 @@ def self.commands
# @yield [reader]
# @yieldparam [RDF::Reader]
# @return [nil]
- def self.parse(files, options = {}, &block)
+ def self.parse(files, options = {}, &block)
if files.empty?
# If files are empty, either use options[:execute]
input = options[:evaluate] ? StringIO.new(options[:evaluate]) : STDIN
@@ -189,7 +189,7 @@ def self.parse(files, options = {}, &block)
end
end
end
-
+
##
# @param [String] msg
# @return [void]
Please sign in to comment.
Something went wrong with that request. Please try again.