Sha256: 477d57e362de07e4861dc27a90e386a67ae5ab4a0126e7dc07a251b4690545e5

Contents?: true

Size: 806 Bytes

Versions: 9

Compression:

Stored size: 806 Bytes

Contents

# frozen_string_literal: true

module SublimeTextKit
  module CLI
    module Actions
      # Handles gem configuration action.
      class Config
        include SublimeTextKit::Import[:kernel, :logger]

        def initialize configuration: Configuration::Loader::CLIENT, **dependencies
          super(**dependencies)
          @configuration = configuration
        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

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

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
sublime_text_kit-14.1.0 lib/sublime_text_kit/cli/actions/config.rb
sublime_text_kit-14.0.0 lib/sublime_text_kit/cli/actions/config.rb
sublime_text_kit-13.5.0 lib/sublime_text_kit/cli/actions/config.rb
sublime_text_kit-13.4.0 lib/sublime_text_kit/cli/actions/config.rb
sublime_text_kit-13.3.0 lib/sublime_text_kit/cli/actions/config.rb
sublime_text_kit-13.2.0 lib/sublime_text_kit/cli/actions/config.rb
sublime_text_kit-13.1.0 lib/sublime_text_kit/cli/actions/config.rb
sublime_text_kit-13.0.1 lib/sublime_text_kit/cli/actions/config.rb
sublime_text_kit-13.0.0 lib/sublime_text_kit/cli/actions/config.rb