Sha256: 896561b3cde9542304362f940e5ee95054e0acaf00aefaeee6970f2a2b9a3d63

Contents?: true

Size: 749 Bytes

Versions: 4

Compression:

Stored size: 749 Bytes

Contents

module Hanami
  module CliBase
    # Add new custom CLI command to special CLI class.
    # Please be careful. This is a private method that
    # can be deleted soon.
    #
    # @since 0.8.0
    # @api private
    #
    # @example Usage with Cli class
    #   require 'hanami'
    #   require 'hanami/cli'
    #
    #   Hanami::Cli.define_commands do
    #     desc 'custom', 'Generate a something'
    #     long_desc <<-EOS
    #       long description for your custom command
    #     EOS
    #     def custom
    #       if options[:help]
    #         invoke :help, ['auth']
    #       else
    #         # ...
    #       end
    #     end
    #   end
    def define_commands(&blk)
      class_eval(&blk) if block_given?
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hanami-0.9.2 lib/hanami/cli_base.rb
hanami-0.9.1 lib/hanami/cli_base.rb
hanami-0.9.0 lib/hanami/cli_base.rb
hanami-0.8.0 lib/hanami/cli_base.rb