code: def command(name=None, cls=None, **attrs):
      r"""Creates a new :class:`Command` and uses the decorated function as
      callback.  This will also automatically attach all decorated
      :func:`option`\s and :func:`argument`\s as parameters to the command.
  
      The name of the command defaults to the name of the function with
      underscores replaced by dashes.  If you want to change that, you can
      pass the intended name as the first argument.
  
      All keyword arguments are forwarded to the underlying command class.
  
      Once decorated the function turns into a :class:`Command` instance
      that can be invoked as a command line utility or be attached to a
      command :class:`Group`.
  
      :param name: the name of the command.  This defaults to the function
                   name with underscores replaced by dashes.
      :param cls: the command class to instantiate.  This defaults to
                  :class:`Command`.
      """
      if cls is None:
          cls = Command
  
      def decorator(f):
          cmd = _make_command(f, name, attrs, cls)
          cmd.__doc__ = f.__doc__
          return cmd
  
      return decorator
  
imports: import inspect
  import sys
  from functools import update_wrapper
  from ._compat import iteritems
  from ._unicodefun import _check_for_unicode_literals
  from .core import Argument
  from .core import Command
  from .core import Group
  from .core import Option
  from .globals import get_current_context
  from .utils import echo
label_desc: Use image node_id 5 for calling a global function with example usage: command(name, cls) and returns: decorator, cmd