Sha256: 05689a77d947a506c73f95e512afbea9df841792991d6f574262fc0f971ec656
Contents?: true
Size: 914 Bytes
Versions: 7
Compression:
Stored size: 914 Bytes
Contents
# frozen_string_literal: true require "core" require "optparse" module Gemsmith module CLI # Assembles and parses all Command Line Interface (CLI) options. class Parser include Import[:configuration] CLIENT = OptionParser.new nil, 40, " " # Order is important. SECTIONS = [Parsers::Core, Rubysmith::CLI::Parsers::Build, Parsers::Build].freeze 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
7 entries across 7 versions & 1 rubygems