Sha256: fc3946d463cd29e0daa73eb9744d132f9786ee05bef3b3b899ce16a4d610e6e3

Contents?: true

Size: 758 Bytes

Versions: 17

Compression:

Stored size: 758 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, **dependencies
          super(**dependencies)

          @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

17 entries across 17 versions & 1 rubygems

Version Path
gemsmith-19.3.0 lib/gemsmith/cli/actions/config.rb
gemsmith-19.2.0 lib/gemsmith/cli/actions/config.rb
gemsmith-19.1.0 lib/gemsmith/cli/actions/config.rb
gemsmith-19.0.0 lib/gemsmith/cli/actions/config.rb
gemsmith-18.9.0 lib/gemsmith/cli/actions/config.rb
gemsmith-18.8.0 lib/gemsmith/cli/actions/config.rb
gemsmith-18.7.0 lib/gemsmith/cli/actions/config.rb
gemsmith-18.6.0 lib/gemsmith/cli/actions/config.rb
gemsmith-18.5.0 lib/gemsmith/cli/actions/config.rb
gemsmith-18.4.0 lib/gemsmith/cli/actions/config.rb
gemsmith-18.3.0 lib/gemsmith/cli/actions/config.rb
gemsmith-18.2.0 lib/gemsmith/cli/actions/config.rb
gemsmith-18.1.1 lib/gemsmith/cli/actions/config.rb
gemsmith-18.1.0 lib/gemsmith/cli/actions/config.rb
gemsmith-18.0.2 lib/gemsmith/cli/actions/config.rb
gemsmith-18.0.1 lib/gemsmith/cli/actions/config.rb
gemsmith-18.0.0 lib/gemsmith/cli/actions/config.rb