Sha256: 4704afab8dd52a1a03d5a35f224036e1207f56a031463826dec7d02b4ee2bb74
Contents?: true
Size: 887 Bytes
Versions: 1
Compression:
Stored size: 887 Bytes
Contents
# frozen_string_literal: true require "core" require "optparse" module Tocer 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::Flag].freeze # Order matters. def initialize sections: SECTIONS, client: CLIENT, **dependencies super(**dependencies) @sections = sections @client = client @configuration_duplicate = configuration.dup end def call arguments = Core::EMPTY_ARRAY sections.each { |parser| parser.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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tocer-15.1.0 | lib/tocer/cli/parser.rb |