3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
# 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?('--help') || argv.include?('-h')
Evm.print_usage_and_die
end
command, argument = argv
begin
const = Evm::Command.const_get(command.capitalize)
const.new(argument, options)
rescue NameError
Evm.die "No such command: #{command}"
rescue Evm::Exception => exception
Evm.die exception.message
end
end
|