Sha256: 53b536f7b514bd9587ca7d429b3010a6c68d746e0552634a3c85131badba494c
Contents?: true
Size: 1.78 KB
Versions: 1
Compression:
Stored size: 1.78 KB
Contents
#! /usr/bin/ruby require 'clevic/browser.rb' require 'optparse' # find and require variations on file_path def require_if( file_path ) require file_path if File.exist?( file_path ) || File.exist?( file_path + '.rb' ) end $options = {} oparser = OptionParser.new oparser.banner = <<BANNER Usage: #{File.basename($0)} [options] model_definition_file model_definition_file, \#{model_definition_file}_models.rb will be searched for. Options are: BANNER oparser.separator '' oparser.on( '-H', '--host HOST', 'RDBMS host', String ) { |o| $options[:host] = o } oparser.on( '-u', '--user USERNAME', String ) { |o| $options[:username] = o } oparser.on( '-p', '--pass PASSWORD', String ) { |o| $options[:password] = o } oparser.on( '-t', '--table TABLE', 'Table to display', String ) { |o| $options[:table] = o } oparser.on( '-d', '--database DATABASE', 'Database name', String ) { |o| $options[:database] = o } oparser.on( '-D', '--debug' ) { |o| $options[:debug] = true } oparser.on( '-v', '--verbose' ) { |o| $options[:verbose] = true } oparser.on( '-h', '-?', '--help' ) do |o| puts oparser.to_s exit( 1 ) end args = oparser.parse( ARGV ) if $options[:debug] require 'pp' pp $options end if args.size > 0 $options[:definition] = args.shift require_if "#{$options[:definition]}_models" require_if $options[:definition] else raise "no model definition file specified" end app = Qt::Application.new( args ) # show UI main_window = Qt::MainWindow.new browser = Clevic::Browser.new( main_window ) # this must come after Clevic::Browser.new # TODO should really find a better place for this main_window.window_title = $options[:database] main_window.show # make sure any partially edited records are saved when the window is closed app.connect( SIGNAL('lastWindowClosed()') ) { browser.save_all } app.exec
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
clevic-0.7.0 | bin/clevic |