Sha256: a517a664e8ed654eacfa23d743b5a650ce823900703537f26155fcc072e52fe8

Contents?: true

Size: 788 Bytes

Versions: 76

Compression:

Stored size: 788 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
        begin
          die("Missing command") if cmd_name.nil?
          Tools.const_get(cmd_name.capitalize.to_sym).new(args).run
        rescue NameError
          die("Unknown command #{cmd_name}")
        rescue => e
          Trollop::die(e.message)
        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

76 entries across 76 versions & 1 rubygems

Version Path
gherkin-1.0.20 lib/gherkin/cli/main.rb
gherkin-1.0.20-i386-mswin32 lib/gherkin/cli/main.rb
gherkin-1.0.20-i386-mingw32 lib/gherkin/cli/main.rb
gherkin-1.0.20-java lib/gherkin/cli/main.rb
gherkin-1.0.19 lib/gherkin/cli/main.rb
gherkin-1.0.19-i386-mswin32 lib/gherkin/cli/main.rb
gherkin-1.0.19-i386-mingw32 lib/gherkin/cli/main.rb
gherkin-1.0.19-java lib/gherkin/cli/main.rb
gherkin-1.0.18 lib/gherkin/cli/main.rb
gherkin-1.0.18-i386-mswin32 lib/gherkin/cli/main.rb
gherkin-1.0.18-i386-mingw32 lib/gherkin/cli/main.rb
gherkin-1.0.18-java lib/gherkin/cli/main.rb
gherkin-1.0.17 lib/gherkin/cli/main.rb
gherkin-1.0.17-i386-mswin32 lib/gherkin/cli/main.rb
gherkin-1.0.17-i386-mingw32 lib/gherkin/cli/main.rb
gherkin-1.0.17-java lib/gherkin/cli/main.rb
gherkin-1.0.16 lib/gherkin/cli/main.rb
gherkin-1.0.16-i386-mswin32 lib/gherkin/cli/main.rb
gherkin-1.0.16-i386-mingw32 lib/gherkin/cli/main.rb
gherkin-1.0.16-java lib/gherkin/cli/main.rb