Sha256: f70bd3e520b5a1755fca6b8bafc661484ae25a9e54b392879749cbfe9d5cc94b

Contents?: true

Size: 856 Bytes

Versions: 7

Compression:

Stored size: 856 Bytes

Contents

# frozen_string_literal: true

module Milestoner
  module CLI
    module Actions
      # Handles the gem configuration action.
      class Config
        def initialize configuration: Configuration::Loader::HANDLER, 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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
milestoner-12.2.0 lib/milestoner/cli/actions/config.rb
milestoner-12.1.0 lib/milestoner/cli/actions/config.rb
milestoner-12.0.4 lib/milestoner/cli/actions/config.rb
milestoner-12.0.3 lib/milestoner/cli/actions/config.rb
milestoner-12.0.2 lib/milestoner/cli/actions/config.rb
milestoner-12.0.1 lib/milestoner/cli/actions/config.rb
milestoner-12.0.0 lib/milestoner/cli/actions/config.rb