lib/tocer/cli/parser.rb in tocer-13.3.1 vs lib/tocer/cli/parser.rb in tocer-14.0.0

- old
+ new

@@ -4,28 +4,31 @@ 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 is important. + SECTIONS = [Parsers::Core, Parsers::Flag].freeze # Order matters. - def initialize sections: SECTIONS, client: CLIENT, container: Container + def initialize sections: SECTIONS, client: CLIENT, **dependencies + super(**dependencies) @sections = sections @client = client - @configuration = container[:configuration].dup + @configuration_duplicate = configuration.dup end def call arguments = [] - sections.each { |parser| parser.call configuration, client: } + sections.each { |parser| parser.call configuration_duplicate, client: } client.parse arguments - configuration.freeze + configuration_duplicate.freeze end def to_s = client.to_s private - attr_reader :sections, :client, :configuration + attr_reader :sections, :client, :configuration_duplicate end end end