6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/dba/shell.rb', line 6
def run(args=ARGV)
print_usage if args.empty? || args == ['--help']
command_name = args.shift
command = commands[command_name]
if command.nil?
raise DBA::Error, "#{command_name} is not a valid command"
end
command = DBA.const_get(command)
command.arity_check(args)
database = DBA::Database.connect
command = command.new(database)
command.call(*args)
rescue DBA::Error => exception
print_error(exception.message)
end
|