Sha256: b4cc333b77585c9b881ea8e26b5e69cf874b3854114a3c050f2fbc400cae452f
Contents?: true
Size: 857 Bytes
Versions: 8
Compression:
Stored size: 857 Bytes
Contents
# frozen_string_literal: true 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 = [] 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
8 entries across 8 versions & 1 rubygems