Sha256: da8fe600ee2987157953e6c9b4bc584b18025fafd529847f4c2bc7ab999e0db5

Contents?: true

Size: 728 Bytes

Versions: 3

Compression:

Stored size: 728 Bytes

Contents

# frozen_string_literal: true

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

3 entries across 3 versions & 1 rubygems

Version Path
tocer-15.2.0 lib/tocer/cli/actions/config.rb
tocer-15.1.2 lib/tocer/cli/actions/config.rb
tocer-15.1.1 lib/tocer/cli/actions/config.rb