Sha256: 22851a1a251ab053fa5290ea5c294734041035a821bf0ce03bbc11754cc646b2

Contents?: true

Size: 839 Bytes

Versions: 2

Compression:

Stored size: 839 Bytes

Contents

# frozen_string_literal: true

module PgEventstore
  module CLI
    module Parsers
      class BaseParser
        class << self
          # @return [String]
          def banner
            raise NotImplementedError
          end
        end

        attr_reader :args, :options

        # @param args [Array<String>]
        # @param options [PgEventstore::CLI::ParserOptions::BaseOptions]
        def initialize(args, options)
          @args = args
          @options = options
          @parser = ::OptionParser.new(self.class.banner)
        end

        # @return [Array<Array<String>, PgEventstore::CLI::ParserOptions::BaseOptions>] list of commands and parsed
        #   options
        def parse
          @options.attach_parser_handlers(@parser)
          [@parser.parse(args), @options]
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pg_eventstore-1.7.0 lib/pg_eventstore/cli/parsers/base_parser.rb
pg_eventstore-1.6.0 lib/pg_eventstore/cli/parsers/base_parser.rb