Sha256: 45c2b3d015be9cde94e9862bdce91ddbd276487b4e6dbba04d56f3c475f0972e

Contents?: true

Size: 932 Bytes

Versions: 6

Compression:

Stored size: 932 Bytes

Contents

# frozen_string_literal: true

require "core"

module Pennyworth
  module CLI
    module Parsers
      # Handles parsing of Command Line Interface (CLI) RubyGems options.
      class RubyGems
        def self.call(...) = new(...).call

        def initialize configuration = Container[:configuration], client: Parser::CLIENT
          @configuration = configuration
          @client = client
        end

        def call arguments = ::Core::EMPTY_ARRAY
          client.separator "\nRUBYGEMS OPTIONS:\n"
          add_owner
          client.parse arguments
          configuration
        end

        private

        attr_reader :configuration, :client

        def add_owner
          client.on "--owner [HANDLE]", %(Set owner. Default: "#{owner}".) do |handle|
            configuration.ruby_gems_owner = handle || owner
          end
        end

        def owner = configuration.ruby_gems_owner
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
pennyworth-14.3.0 lib/pennyworth/cli/parsers/ruby_gems.rb
pennyworth-14.2.1 lib/pennyworth/cli/parsers/ruby_gems.rb
pennyworth-14.2.0 lib/pennyworth/cli/parsers/ruby_gems.rb
pennyworth-14.1.2 lib/pennyworth/cli/parsers/ruby_gems.rb
pennyworth-14.1.1 lib/pennyworth/cli/parsers/ruby_gems.rb
pennyworth-14.1.0 lib/pennyworth/cli/parsers/ruby_gems.rb