lib/oci8_simple/cli.rb in oci8_simple-0.5.0 vs lib/oci8_simple/cli.rb in oci8_simple-0.6.0
- old
+ new
@@ -4,10 +4,12 @@
# formats the output in a manner suitable for printing on the console
# == Usage
# cli = Oci8Simple::Cli.new
# cli.run "select id, name from foos" # "3, Bacon\n5, Cheese Puffs\n..."
class Cli
+ include Command
+
attr_accessor :env, :client
def initialize(env=nil)
self.env = env
end
@@ -27,17 +29,10 @@
def self.usage
"Usage: #{$0} \"SQL\" [ENV]"
end
def self.run_from_argv
- o = OptionParser.new do |opt|
- opt.banner = usage
- opt.on("-v", "--version", "Show version") do
- puts "version #{File.read(File.join(File.dirname(__FILE__), '..', '..', 'VERSION'))}"
- exit
- end
- end
- o.parse!
+ o = parse_options(self.usage)
if(ARGV[0].nil?)
puts o
else
puts self.new(ARGV[1]).run(ARGV[0])
end
\ No newline at end of file