Sha256: 2394fecb7ac160be758c86581043d4a7571803cf115ae0c20541d1508b6543fe

Contents?: true

Size: 802 Bytes

Versions: 11

Compression:

Stored size: 802 Bytes

Contents

# frozen_string_literal: true

module Milestoner
  module CLI
    module Actions
      # Handles the gem configuration action.
      class Config
        include Milestoner::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

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
milestoner-15.2.0 lib/milestoner/cli/actions/config.rb
milestoner-15.1.0 lib/milestoner/cli/actions/config.rb
milestoner-15.0.0 lib/milestoner/cli/actions/config.rb
milestoner-14.5.0 lib/milestoner/cli/actions/config.rb
milestoner-14.4.0 lib/milestoner/cli/actions/config.rb
milestoner-14.3.0 lib/milestoner/cli/actions/config.rb
milestoner-14.2.0 lib/milestoner/cli/actions/config.rb
milestoner-14.1.0 lib/milestoner/cli/actions/config.rb
milestoner-14.0.2 lib/milestoner/cli/actions/config.rb
milestoner-14.0.1 lib/milestoner/cli/actions/config.rb
milestoner-14.0.0 lib/milestoner/cli/actions/config.rb