Sha256: a6dd44483d3d50b38bfac09574cf951d464c17fe9da8ebfc64922d133b1852c6

Contents?: true

Size: 581 Bytes

Versions: 1

Compression:

Stored size: 581 Bytes

Contents

# frozen_string_literal: true

require_relative '../command'

module Dru
  module Commands
    class Attach < Dru::Command
      ATTACH_COMMAND = 'attach'

      def initialize(service:, options:)
        @service = service
        @options = options
      end

      def execute(input: $stdin, output: $stdout)
        run_docker_command(ATTACH_COMMAND, detach_keys, container_id)
      end

      private

      def detach_keys
        "--detach-keys=#{@options[:detach_keys]}"
      end

      def container_id
        container_name_to_id(@service)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dru-1.0.0 lib/dru/commands/attach.rb