Sha256: bf81853d04ba2bab90608198759ae65173ab736942dc806fbcbb9fc039066b09

Contents?: true

Size: 791 Bytes

Versions: 3

Compression:

Stored size: 791 Bytes

Contents

# frozen_string_literal: true

module Rubysmith
  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

3 entries across 3 versions & 1 rubygems

Version Path
rubysmith-0.12.0 lib/rubysmith/cli/processors/config.rb
rubysmith-0.11.0 lib/rubysmith/cli/processors/config.rb
rubysmith-0.10.0 lib/rubysmith/cli/processors/config.rb