Module: Hanami::CliBase

Overview

Since:

  • 0.1.0

Instance Method Summary collapse

Instance Method Details

#define_commands(&blk) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Add new custom CLI command to special CLI class. Please be careful. This is a private method that can be deleted soon.

Examples:

Usage with Cli class

require 'hanami'
require 'hanami/cli'

Hanami::Cli.define_commands do
  desc 'custom', 'Generate a something'
  long_desc "long description for your custom command\n"
  def custom
    if options[:help]
      invoke :help, ['auth']
    else
      # ...
    end
  end
end

Since:

  • 0.8.0


27
28
29
# File 'lib/hanami/cli_base.rb', line 27

def define_commands(&blk)
  class_eval(&blk) if block_given?
end