Sha256: a13b216846732a46678afaa7086b7bfcaaa0dcd6a8a48f5dbb35c85c1dcc840b

Contents?: true

Size: 856 Bytes

Versions: 10

Compression:

Stored size: 856 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, **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
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
git-lint-5.1.0 lib/git/lint/cli/actions/config.rb
git-lint-5.0.0 lib/git/lint/cli/actions/config.rb
git-lint-4.6.0 lib/git/lint/cli/actions/config.rb
git-lint-4.5.0 lib/git/lint/cli/actions/config.rb
git-lint-4.4.0 lib/git/lint/cli/actions/config.rb
git-lint-4.3.0 lib/git/lint/cli/actions/config.rb
git-lint-4.2.0 lib/git/lint/cli/actions/config.rb
git-lint-4.1.0 lib/git/lint/cli/actions/config.rb
git-lint-4.0.1 lib/git/lint/cli/actions/config.rb
git-lint-4.0.0 lib/git/lint/cli/actions/config.rb