Sha256: 739742fb11fd66bb886bcc686312041caff24da154a457f049b955f7a2b6e725

Contents?: true

Size: 740 Bytes

Versions: 9

Compression:

Stored size: 740 Bytes

Contents

# frozen_string_literal: true

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

9 entries across 9 versions & 1 rubygems

Version Path
hanamismith-0.12.0 lib/hanamismith/cli/actions/config.rb
hanamismith-0.11.0 lib/hanamismith/cli/actions/config.rb
hanamismith-0.10.0 lib/hanamismith/cli/actions/config.rb
hanamismith-0.9.0 lib/hanamismith/cli/actions/config.rb
hanamismith-0.8.0 lib/hanamismith/cli/actions/config.rb
hanamismith-0.7.0 lib/hanamismith/cli/actions/config.rb
hanamismith-0.6.0 lib/hanamismith/cli/actions/config.rb
hanamismith-0.5.0 lib/hanamismith/cli/actions/config.rb
hanamismith-0.4.0 lib/hanamismith/cli/actions/config.rb