Sha256: 70f8336488f58588e7e00c39c017c5b2916d21778510233aa6a38ba0ec154b58

Contents?: true

Size: 809 Bytes

Versions: 4

Compression:

Stored size: 809 Bytes

Contents

# frozen_string_literal: true

module Tocer
  module CLI
    module Actions
      # Handles the config action.
      class Config
        def initialize client: Configuration::Loader::CLIENT, container: Container
          @client = client
          @container = container
        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, :container

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

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

        def kernel = container[__method__]

        def logger = container[__method__]
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
tocer-13.3.1 lib/tocer/cli/actions/config.rb
tocer-13.3.0 lib/tocer/cli/actions/config.rb
tocer-13.2.0 lib/tocer/cli/actions/config.rb
tocer-13.1.0 lib/tocer/cli/actions/config.rb