3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/evm/cli.rb', line 3
def self.parse(argv)
options = {}
if argv.include?('--force')
options[:force] = !!argv.delete('--force')
end
if argv.include?('--skip')
options[:skip] = !!argv.delete('--skip')
end
if argv.include?('--use')
options[:use] = !!argv.delete('--use')
end
command, argument = argv
if argv.include?('--help') || argv.include?('-h') || command.nil?
Evm.print_usage_and_exit
end
begin
const = Evm::Command.const_get(command.capitalize)
rescue NameError => exception
Evm.abort 'No such command:', command
end
begin
const.new(argument, options)
rescue Evm::Exception => exception
Evm.abort exception.message
end
end
|