Sha256: 8e18e03d1c1610bc6f35d7130d10c4239735740197879ff7f5d4e98502d1a888
Contents?: true
Size: 876 Bytes
Versions: 6
Compression:
Stored size: 876 Bytes
Contents
# frozen_string_literal: true require "core" require "optparse" module Rubysmith module CLI # Assembles and parses all Command Line Interface (CLI) options. class Parser include Import[:configuration] CLIENT = OptionParser.new nil, 40, " " SECTIONS = [Parsers::Core, Parsers::Build].freeze # Order is important. def initialize(sections: SECTIONS, client: CLIENT, **) super(**) @sections = sections @client = client @configuration_duplicate = configuration.dup end def call arguments = Core::EMPTY_ARRAY sections.each { |section| section.call configuration_duplicate, client: } client.parse arguments configuration_duplicate.freeze end def to_s = client.to_s private attr_reader :sections, :client, :configuration_duplicate end end end
Version data entries
6 entries across 6 versions & 1 rubygems