Sha256: cf8ddfddb12fa112c24d0092fea04e9e2a2feac32931889369bf9c2ee9bd9463

Contents?: true

Size: 901 Bytes

Versions: 9

Compression:

Stored size: 901 Bytes

Contents

# frozen_string_literal: true

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 = Configuration::Loader.call, client: CLIENT
          @configuration = configuration
          @client = client
        end

        def call arguments = []
          client.separator "\nRUBYGEMS OPTIONS:\n"
          add_owner
          arguments.empty? ? arguments : client.parse!(arguments)
        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

9 entries across 9 versions & 1 rubygems

Version Path
pennyworth-11.2.2 lib/pennyworth/cli/parsers/ruby_gems.rb
pennyworth-11.2.1 lib/pennyworth/cli/parsers/ruby_gems.rb
pennyworth-11.2.0 lib/pennyworth/cli/parsers/ruby_gems.rb
pennyworth-11.1.3 lib/pennyworth/cli/parsers/ruby_gems.rb
pennyworth-11.1.2 lib/pennyworth/cli/parsers/ruby_gems.rb
pennyworth-11.1.1 lib/pennyworth/cli/parsers/ruby_gems.rb
pennyworth-11.1.0 lib/pennyworth/cli/parsers/ruby_gems.rb
pennyworth-11.0.1 lib/pennyworth/cli/parsers/ruby_gems.rb
pennyworth-11.0.0 lib/pennyworth/cli/parsers/ruby_gems.rb