Sha256: 7b055fca22af815862ba32f1da85cd4ca7e10b177ecd0969f7cd43549c01b942

Contents?: true

Size: 821 Bytes

Versions: 12

Compression:

Stored size: 821 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::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}"
        end

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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rubysmith-0.9.1 lib/rubysmith/cli/processors/config.rb
rubysmith-0.9.0 lib/rubysmith/cli/processors/config.rb
rubysmith-0.8.0 lib/rubysmith/cli/processors/config.rb
rubysmith-0.7.0 lib/rubysmith/cli/processors/config.rb
rubysmith-0.6.1 lib/rubysmith/cli/processors/config.rb
rubysmith-0.6.0 lib/rubysmith/cli/processors/config.rb
rubysmith-0.5.0 lib/rubysmith/cli/processors/config.rb
rubysmith-0.4.0 lib/rubysmith/cli/processors/config.rb
rubysmith-0.3.0 lib/rubysmith/cli/processors/config.rb
rubysmith-0.2.0 lib/rubysmith/cli/processors/config.rb
rubysmith-0.1.1 lib/rubysmith/cli/processors/config.rb
rubysmith-0.1.0 lib/rubysmith/cli/processors/config.rb