Class: Hanami::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/hanami/cli/commands.rb,
lib/hanami/cli/commands/db.rb,
lib/hanami/cli/commands/new.rb,
lib/hanami/cli/commands/assets.rb,
lib/hanami/cli/commands/routes.rb,
lib/hanami/cli/commands/server.rb,
lib/hanami/cli/commands/command.rb,
lib/hanami/cli/commands/console.rb,
lib/hanami/cli/commands/db/drop.rb,
lib/hanami/cli/commands/destroy.rb,
lib/hanami/cli/commands/project.rb,
lib/hanami/cli/commands/version.rb,
lib/hanami/cli/commands/db/apply.rb,
lib/hanami/cli/commands/generate.rb,
lib/hanami/cli/commands/db/create.rb,
lib/hanami/cli/commands/templates.rb,
lib/hanami/cli/commands/db/console.rb,
lib/hanami/cli/commands/db/migrate.rb,
lib/hanami/cli/commands/db/prepare.rb,
lib/hanami/cli/commands/db/version.rb,
lib/hanami/cli/commands/db/rollback.rb,
lib/hanami/cli/commands/destroy/app.rb,
lib/hanami/cli/commands/generate/app.rb,
lib/hanami/cli/commands/destroy/model.rb,
lib/hanami/cli/commands/destroy/action.rb,
lib/hanami/cli/commands/destroy/mailer.rb,
lib/hanami/cli/commands/generate/model.rb,
lib/hanami/cli/commands/generate/action.rb,
lib/hanami/cli/commands/generate/mailer.rb,
lib/hanami/cli/commands/generate/secret.rb,
lib/hanami/cli/commands/assets/precompile.rb,
lib/hanami/cli/commands/destroy/migration.rb,
lib/hanami/cli/commands/generate/migration.rb

Overview

Hanami CLI

Since:

  • 1.1.0

Defined Under Namespace

Modules: Commands

Class Method Summary collapse

Class Method Details

.register(name, command = nil, aliases: [], &blk) ⇒ Object

Register a command to expand Hanami CLI

Examples:

Third party gem

require "hanami/cli/commands"

module Hanami
  module Webpack
    module CLI
      module Commands
        class Generate < Hanami::CLI::Command
          desc "Generate Webpack config"

          def call(*)
            # ...
          end
        end
      end
    end
  end
end

Hanami::CLI.register "generate webpack", Hanami::Webpack::CLI::Commands::Generate

# $ bundle exec hanami generate
# Commands:
#   hanami generate action APP ACTION                    # Generate an action for app
#   hanami generate app APP                              # Generate an app
#   hanami generate mailer MAILER                        # Generate a mailer
#   hanami generate migration MIGRATION                  # Generate a migration
#   hanami generate model MODEL                          # Generate a model
#   hanami generate secret [APP]                         # Generate session secret
#   hanami generate webpack                              # Generate Webpack configuration

Since:

  • 1.1.0


48
49
50
# File 'lib/hanami/cli/commands.rb', line 48

def self.register(name, command = nil, aliases: [], &blk)
  Commands.register(name, command, aliases: aliases, &blk)
end