Sha256: ee93236682ee521b00894316341ad2623da9b51d560e08ed6a5f7241136403d6
Contents?: true
Size: 772 Bytes
Versions: 4
Compression:
Stored size: 772 Bytes
Contents
# frozen_string_literal: true require "optparse" module Tocer module CLI # Assembles and parses all Command Line Interface (CLI) options. class Parser CLIENT = OptionParser.new nil, 40, " " SECTIONS = [Parsers::Core, Parsers::Flag].freeze # Order is important. def initialize sections: SECTIONS, client: CLIENT, container: Container @sections = sections @client = client @configuration = container[:configuration].dup end def call arguments = [] sections.each { |parser| parser.call configuration, client: } client.parse arguments configuration.freeze end def to_s = client.to_s private attr_reader :sections, :client, :configuration end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
tocer-13.3.1 | lib/tocer/cli/parser.rb |
tocer-13.3.0 | lib/tocer/cli/parser.rb |
tocer-13.2.0 | lib/tocer/cli/parser.rb |
tocer-13.1.0 | lib/tocer/cli/parser.rb |