Sha256: 4b6dafbfb1f588f593ee7fbfe618914ed9340a00a29220a736edc7b23376d9b9

Contents?: true

Size: 912 Bytes

Versions: 8

Compression:

Stored size: 912 Bytes

Contents

# frozen_string_literal: true

module Git
  module Lint
    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
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
git-lint-3.3.2 lib/git/lint/cli/actions/config.rb
git-lint-3.3.1 lib/git/lint/cli/actions/config.rb
git-lint-3.3.0 lib/git/lint/cli/actions/config.rb
git-lint-3.2.0 lib/git/lint/cli/actions/config.rb
git-lint-3.1.0 lib/git/lint/cli/actions/config.rb
git-lint-3.0.2 lib/git/lint/cli/actions/config.rb
git-lint-3.0.1 lib/git/lint/cli/actions/config.rb
git-lint-3.0.0 lib/git/lint/cli/actions/config.rb