Sha256: a0db153100c4cb168d6c6193bb0b230b825b558bc437044629976d6bafdaba7c

Contents?: true

Size: 862 Bytes

Versions: 1

Compression:

Stored size: 862 Bytes

Contents

# frozen_string_literal: true

module Neptuno
  module CLI
    # Init Neptuno files
    class Execute < Neptuno::CLI::Base
      include TTY::File
      include TTY::Config

      desc "Execute service script"

      def call(**options)
        command_service_to("execute", service_as_args: options[:args]&.first) do |service, _project|
          commands = Dir.glob("#{neptuno_path}/scripts/#{service}/*").map { |x| x.split("/") }.map(&:last)
          command = options[:args].last if commands.include?(options[:args]&.last)
          puts "#{neptuno_path}/scripts/#{service}/*"
          puts service
          puts commands
          puts Dir.glob("#{neptuno_path}/scripts/#{service}/*")
          command ||= prompt.select("execute", commands || [])
          `cd #{neptuno_path}/scripts/#{service} && ./#{command}`
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
neptuno-1.5.0 lib/neptuno/cli/execute.rb