Sha256: 16f7b44d6257fcb97fc1e6bbd7826abe7cb81afac1dcd5782efab556beff4e09

Contents?: true

Size: 855 Bytes

Versions: 7

Compression:

Stored size: 855 Bytes

Contents

# frozen_string_literal: true

module SublimeTextKit
  module CLI
    module Actions
      # Handles gem configuration action.
      class Config
        def initialize configuration: Configuration::Loader::CLIENT, container: Container
          @configuration = configuration
          @container = container
        end

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

        private

        attr_reader :configuration, :container

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

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

        def kernel = container[__method__]

        def logger = container[__method__]
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sublime_text_kit-12.3.2 lib/sublime_text_kit/cli/actions/config.rb
sublime_text_kit-12.3.1 lib/sublime_text_kit/cli/actions/config.rb
sublime_text_kit-12.3.0 lib/sublime_text_kit/cli/actions/config.rb
sublime_text_kit-12.2.0 lib/sublime_text_kit/cli/actions/config.rb
sublime_text_kit-12.1.0 lib/sublime_text_kit/cli/actions/config.rb
sublime_text_kit-12.0.1 lib/sublime_text_kit/cli/actions/config.rb
sublime_text_kit-12.0.0 lib/sublime_text_kit/cli/actions/config.rb