Sha256: 691c7b88dce533018fe3d1f2b926614536212dc0c7d2c33dd9d11b3572b0707d

Contents?: true

Size: 812 Bytes

Versions: 5

Compression:

Stored size: 812 Bytes

Contents

# frozen_string_literal: true

module Gemsmith
  module CLI
    module Actions
      # Handles the config action.
      class Config
        def initialize client: Configuration::Loader::CLIENT, container: Container
          @client = client
          @container = container
        end

        def call selection
          case selection
            when :edit then edit
            when :view then view
            else logger.error { "Invalid configuration selection: #{selection}." }
          end
        end

        private

        attr_reader :client, :container

        def edit = kernel.system("$EDITOR #{client.current}")

        def view = kernel.system("cat #{client.current}")

        def kernel = container[__method__]

        def logger = container[__method__]
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
gemsmith-17.0.1 lib/gemsmith/cli/actions/config.rb
gemsmith-17.0.0 lib/gemsmith/cli/actions/config.rb
gemsmith-16.2.0 lib/gemsmith/cli/actions/config.rb
gemsmith-16.1.0 lib/gemsmith/cli/actions/config.rb
gemsmith-16.0.0 lib/gemsmith/cli/actions/config.rb