Sha256: fc2af55f1bc5d102a7e6a654e7831eb326f25093c78ad03e690808f728eb0807

Contents?: true

Size: 878 Bytes

Versions: 1

Compression:

Stored size: 878 Bytes

Contents

# frozen_string_literal: true

require 'async_active_job'
require 'async_active_job/runner'
require 'dry/cli'

module AsyncActiveJob
  module CLI
    module Commands
      extend Dry::CLI::Registry

      class Version < Dry::CLI::Command
        desc 'Print version'

        def call(*)
          Rails.logger.debug AsyncActiveJob::VERSION
        end
      end

      class Start < Dry::CLI::Command
        desc 'Start worker'

        option :queues, desc: 'comma separated list of queue names'

        def call(queues: nil, **)
          queues = queues&.split(',')
          AsyncActiveJob::Runner.start(queues: queues)
        end
      end

      register 'version', Version, aliases: ['v', '-v', '--version']
      register 'start', Start
    end

    module_function

    def call(arguments)
      Dry::CLI.new(Commands).call(arguments: arguments)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
async_active_job-0.1.0 lib/async_active_job/cli.rb