Sha256: 3243313fbde804ea1aae8934e90205fefa7fbf7b091102bd88eb508b40a2e26d

Contents?: true

Size: 813 Bytes

Versions: 8

Compression:

Stored size: 813 Bytes

Contents

# frozen_string_literal: true

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

8 entries across 8 versions & 1 rubygems

Version Path
rubysmith-2.0.2 lib/rubysmith/cli/actions/config.rb
rubysmith-2.0.1 lib/rubysmith/cli/actions/config.rb
rubysmith-2.0.0 lib/rubysmith/cli/actions/config.rb
rubysmith-1.3.0 lib/rubysmith/cli/actions/config.rb
rubysmith-1.2.0 lib/rubysmith/cli/actions/config.rb
rubysmith-1.1.1 lib/rubysmith/cli/actions/config.rb
rubysmith-1.1.0 lib/rubysmith/cli/actions/config.rb
rubysmith-1.0.0 lib/rubysmith/cli/actions/config.rb