Sha256: 7a6b2921b73b640c1c923267c62f6c4852af20b1785b66670e18a8fdbf83620d

Contents?: true

Size: 512 Bytes

Versions: 1

Compression:

Stored size: 512 Bytes

Contents

# frozen_string_literal: true

module Dru
  class Argv
    attr_reader :argv

    def initialize(argv = ARGV)
      @argv = argv
    end

    def parse
      return argv unless docker_compose_command_index

      argv.dup.insert(docker_compose_command_index, Thor::Options::OPTS_END)
    end

    private

    def docker_compose_command_index
      argv.index { |arg| docker_compose_command?(arg) }
    end

    def docker_compose_command?(arg)
      Dru::DOCKER_COMPOSE_COMMANDS.include?(arg)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
dru-0.6.0 lib/dru/argv.rb