lib/oci8_simple/describe.rb in oci8_simple-0.5.0 vs lib/oci8_simple/describe.rb in oci8_simple-0.6.0
- old
+ new
@@ -3,10 +3,12 @@
# This class creates a string describing a table's columns, intended to be
# displayed in a fixed-width font.
# == Usage
# Oci8Simple::Describe.new("development").run("users")
class Describe
+ include Command
+
SPACE_BETWEEN=2
FIELDS=[
{:select => "NULLABLE", :header => "Required", :content => :format_nullable, :right => true},
{:select => "lower(COLUMN_NAME)", :header=> "Name"},
{:select => "lower(DATA_TYPE)", :header => "Type"},
@@ -33,21 +35,14 @@
def initialize(env=nil)
@env = env || "development"
end
def self.usage
- "Usage: #{0} TABLE_NAME [ENVIRONMENT]"
+ "Usage: #{$0} TABLE_NAME [ENVIRONMENT]"
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