Sha256: c2ff1e99314c62e9836b72cf6b2f47a418e382ad6237860cced2da167d1ba99c

Contents?: true

Size: 813 Bytes

Versions: 6

Compression:

Stored size: 813 Bytes

Contents

# frozen_string_literal: true

module Pragmater
  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

6 entries across 6 versions & 1 rubygems

Version Path
pragmater-10.3.1 lib/pragmater/cli/actions/config.rb
pragmater-10.3.0 lib/pragmater/cli/actions/config.rb
pragmater-10.2.0 lib/pragmater/cli/actions/config.rb
pragmater-10.1.0 lib/pragmater/cli/actions/config.rb
pragmater-10.0.1 lib/pragmater/cli/actions/config.rb
pragmater-10.0.0 lib/pragmater/cli/actions/config.rb