Sha256: 9caf1f002f7136d8f0afe43d015762ba24ef26a0e908367ff547345aa1a54212

Contents?: true

Size: 787 Bytes

Versions: 7

Compression:

Stored size: 787 Bytes

Contents

# frozen_string_literal: true

module Tocer
  module CLI
    module Processors
      # Handles the Command Line Interface (CLI) configuration processing.
      class Config
        def initialize configuration: CLI::Configuration::Loader::CLIENT, kernel: Kernel
          @configuration = configuration
          @kernel = kernel
        end

        def call action
          case action
            when :edit then edit
            when :view then view
            else fail StandardError, "Invalid configuration action: #{action}."
          end
        end

        private

        attr_reader :configuration, :kernel

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

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

Version data entries

7 entries across 7 versions & 1 rubygems

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