Sha256: 8c7c50574a06e4eb1c7ae3c40fd38a5109df9669d8fa1f68d0320f985506b805

Contents?: true

Size: 734 Bytes

Versions: 7

Compression:

Stored size: 734 Bytes

Contents

# frozen_string_literal: true

module Gemsmith
  module CLI
    module Actions
      # Handles the config action.
      class Config
        include Gemsmith::Import[:kernel, :logger]

        def initialize(client: Configuration::Loader::CLIENT, **)
          super(**)
          @client = client
        end

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

        private

        attr_reader :client

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

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
gemsmith-19.8.0 lib/gemsmith/cli/actions/config.rb
gemsmith-19.7.0 lib/gemsmith/cli/actions/config.rb
gemsmith-19.6.0 lib/gemsmith/cli/actions/config.rb
gemsmith-19.5.2 lib/gemsmith/cli/actions/config.rb
gemsmith-19.5.1 lib/gemsmith/cli/actions/config.rb
gemsmith-19.5.0 lib/gemsmith/cli/actions/config.rb
gemsmith-19.4.0 lib/gemsmith/cli/actions/config.rb