Sha256: 8819dde9b622a9898564cde067f144f3db45de9737c7fec6756ec83186002cb7

Contents?: true

Size: 1.1 KB

Versions: 8

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

require_relative "../base_command"

module Hanami
  class CLI
    module Application
      # Hanami application CLI command (intended to run inside application directory)
      class Command < BaseCommand
        def self.inherited(klass)
          super

          klass.option :env, aliases: ["-e"], default: nil, desc: "Application environment"
        end

        attr_reader :application

        def initialize(application: nil, **opts)
          super(**opts)
          @application = application
        end

        def with_application(application)
          self.class.new(
            command_name: @command_name,
            application: application,
            out: out,
            inflector: application.inflector,
            files: files,
          )
        end

        private

        def run_command(klass, *args)
          klass.new(
            command_name: klass.name,
            application: application,
            out: out,
            inflector: application.inflector,
            files: files,
          ).call(*args)
        end
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
hanami-2.0.0.alpha8 lib/hanami/cli/application/command.rb
hanami-2.0.0.alpha7.1 lib/hanami/cli/application/command.rb
hanami-2.0.0.alpha7 lib/hanami/cli/application/command.rb
hanami-2.0.0.alpha6 lib/hanami/cli/application/command.rb
hanami-2.0.0.alpha5 lib/hanami/cli/application/command.rb
hanami-2.0.0.alpha4 lib/hanami/cli/application/command.rb
hanami-2.0.0.alpha3 lib/hanami/cli/application/command.rb
hanami-2.0.0.alpha2 lib/hanami/cli/application/command.rb