Sha256: 726697cd0e236aaa87322d3abdf6c8731e90f20a3a1bd315e2eac4b7879b496b
Contents?: true
Size: 908 Bytes
Versions: 15
Compression:
Stored size: 908 Bytes
Contents
# frozen_string_literal: true 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, **dependencies super(**dependencies) @sections = sections @client = client @configuration_duplicate = configuration.dup end def call arguments = [] 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
15 entries across 15 versions & 1 rubygems