Sha256: 4ca46561524e68f907c39035211d89e7fe14f8082010765495a81470f8ecdae4
Contents?: true
Size: 850 Bytes
Versions: 7
Compression:
Stored size: 850 Bytes
Contents
# frozen_string_literal: true require "optparse" module Pennyworth module CLI # Assembles and parses all Command Line Interface (CLI) options. class Parser CLIENT = OptionParser.new nil, 40, " " SECTIONS = [Parsers::Core, Parsers::GitHub, Parsers::RubyGems].freeze # Order is important. def initialize configuration = Configuration::Loader.call, sections: SECTIONS, client: CLIENT @configuration = configuration.dup @sections = sections @client = client end def call arguments = [] sections.each { |parser| parser.call configuration, client: } client.parse arguments configuration.freeze end def to_s = client.to_s private attr_reader :configuration, :client, :sections end end end
Version data entries
7 entries across 7 versions & 1 rubygems