Class: EchSpec::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/echspec/cli.rb,
lib/echspec/cli/run.rb,
lib/echspec/cli/grease.rb,
lib/echspec/cli/resolve.rb,
lib/echspec/cli/gen_configs.rb,
lib/echspec/cli/ech_config_printer.rb

Defined Under Namespace

Modules: EchConfigPrinter Classes: GenConfigs, Grease, Resolve, Run

Instance Method Summary collapse

Instance Method Details

#execute(argv = ARGV) ⇒ Object



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/echspec/cli.rb', line 11

def execute(argv = ARGV)
  subcommands = i[run gen_configs resolve grease]

  op = OptionParser.new

  op.banner = "    Usage: echspec {SUBCOMMAND}\n\n    Available subcommands: \#{subcommands.join(', ')}, version, help.\n  USAGE\n\n  op.version = EchSpec::VERSION\n  op.order!(argv)\n\n  subcommand = argv.shift\n  case subcommand&.to_sym\n  when :version\n    puts EchSpec::VERSION\n  when *subcommands\n    klass = self.class.const_get(subcommand.to_camel)\n    klass.new.__send__(:execute, argv)\n  else\n    puts op\n  end\nend\n"