Sha256: dea9393ff8e7dccea66eb86d962e52dab8fab9750ef0527b2df1e0e0c100f4fd
Contents?: true
Size: 1.38 KB
Versions: 3
Compression:
Stored size: 1.38 KB
Contents
# frozen_string_literal: true require "core" require "refinements/structs" module Gemsmith module CLI module Parsers # Handles parsing of Command Line Interface (CLI) build options. class Build include Import[:color] using Refinements::Structs def self.call(...) = new(...).call def initialize(configuration = Container[:configuration], client: Parser::CLIENT, **) super(**) @configuration = configuration @client = client end def call arguments = ::Core::EMPTY_ARRAY add_cli client.parse arguments configuration end private attr_reader :configuration, :client def add_cli client.on( "--[no-]cli", "Add command line interface. #{default __method__}." ) do |value| configuration.merge! build_refinements: value, build_zeitwerk: value if value configuration.merge! build_cli: value end end def default option option.to_s .sub("add_", "build_") .then { |attribute| configuration.public_send attribute } .then { |boolean| boolean ? color[boolean, :green] : color[boolean, :red] } .then { |colored_boolean| "Default: #{colored_boolean}" } end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
gemsmith-19.8.0 | lib/gemsmith/cli/parsers/build.rb |
gemsmith-19.7.0 | lib/gemsmith/cli/parsers/build.rb |
gemsmith-19.6.0 | lib/gemsmith/cli/parsers/build.rb |