Sha256: 4b01c3d8859f3da9da67f0ff1543623f2a28ef32339113e19fd2b48b14f47d4e

Contents?: true

Size: 763 Bytes

Versions: 15

Compression:

Stored size: 763 Bytes

Contents

begin
  require 'trollop'
rescue LoadError
  require 'rubygems'
  require 'trollop'
end
require 'gherkin/tools'

module Gherkin
  module Cli
    class Main
      def self.run(args)
        Trollop::options(args) do
          banner "Super fast gherkin parser"
          stop_on Tools::SUB_COMMANDS
        end

        cmd_name = args.shift
        die("Missing command") if cmd_name.nil?
        begin
          cmd = Tools.const_get(cmd_name.capitalize.to_sym).new(args)
          cmd.run
        rescue => e
          Trollop::die(e.message + "\nCommand: #{cmd_name}")
        end
      end

      def self.die(msg)
        Trollop::die("#{msg}\nusage: gherkin COMMAND [ARGS]\nAvailable commands: #{Tools::SUB_COMMANDS.join(' ')}")
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
gherkin-2.0.1 lib/gherkin/cli/main.rb
gherkin-2.0.1-i386-mswin32 lib/gherkin/cli/main.rb
gherkin-2.0.1-i386-mingw32 lib/gherkin/cli/main.rb
gherkin-2.0.1-universal-dotnet lib/gherkin/cli/main.rb
gherkin-2.0.1-java lib/gherkin/cli/main.rb
gherkin-2.0.0 lib/gherkin/cli/main.rb
gherkin-2.0.0-i386-mswin32 lib/gherkin/cli/main.rb
gherkin-2.0.0-i386-mingw32 lib/gherkin/cli/main.rb
gherkin-2.0.0-universal-dotnet lib/gherkin/cli/main.rb
gherkin-2.0.0-java lib/gherkin/cli/main.rb
gherkin-1.0.30 lib/gherkin/cli/main.rb
gherkin-1.0.30-i386-mswin32 lib/gherkin/cli/main.rb
gherkin-1.0.30-i386-mingw32 lib/gherkin/cli/main.rb
gherkin-1.0.30-universal-dotnet lib/gherkin/cli/main.rb
gherkin-1.0.30-java lib/gherkin/cli/main.rb