Sha256: 0f1955953329c846e142542e844551c71fe1b10165507edc261cd9f19783dd75

Contents?: true

Size: 833 Bytes

Versions: 4

Compression:

Stored size: 833 Bytes

Contents

# frozen_string_literal: true

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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
git-lint-5.3.0 lib/git/lint/cli/actions/config.rb
git-lint-5.2.0 lib/git/lint/cli/actions/config.rb
git-lint-5.1.2 lib/git/lint/cli/actions/config.rb
git-lint-5.1.1 lib/git/lint/cli/actions/config.rb