A group allows a command to have subcommands attached.  This is the
        most common way to implement nesting in Click.

        :param name: the name of the group (optional)
        :param commands: a dictionary of commands.
3203
def group(self, *args, **kwargs):
        
        return super().group(
            *args, cls=kwargs.pop('cls', AppGroup) or AppGroup, **kwargs)
1115550
def _rudimentary_get_command(self, args):
        
        nouns = []
        command_names = self.commands_loader.command_table.keys()
        for arg in args:
            if arg and arg[0] != '-':
                nouns.append(arg)
            else:
                break

        def _find_args(args):
            search = ' '.join(args).lower()
            return next((x for x in command_names if x.startswith(search)), False)

        # since the command name may be immediately followed by a positional arg, strip those off
        while nouns and not _find_args(nouns):
            del nouns[-1]

        # ensure the command string is case-insensitive
        for i in range(len(nouns)):
            args[i] = args[i].lower()

        return ' '.join(nouns)
777683
def _add_command(self, name, **parameters):
        
        command = self._create_command(name, **parameters)
        self._commands.append(command)

        return command
501774
function (commandName, fn) {
            var config = this.config;
            config.commands = config.commands || {};
            config.commands[commandName] = fn;
        }
523010
function getCommand(commandName) {
    return _.find(commands, function (command) {
      return _.includes(command.aliases, commandName);
    });
  }
600283
def command(command_name, *args)
      response_key = "#{command_name}_response".to_sym
      result_key = "#{command_name}_result".to_sym

      message = args.last.is_a?(Hash) ? args.pop : {}
      result = @client.call command_name,
                            cookies: @auth_cookie,
                            message: { :token => @login_token }.merge(message)

      result.hash[:envelope][:body][response_key][result_key]
    end
535912
function( name )
	{
		var item	= this._.items[ name ],
			handler	= item && this._.handlers[ item.type ],
			command = item && item.command && this._.editor.getCommand( item.command );

		var result = handler && handler.create.apply( this, item.args );

		// Allow overrides from skin ui definitions..
		item && ( result = CKEDITOR.tools.extend( result, this._.editor.skin[ item.type ], true ) );

		// Add reference inside command object.
		if ( command )
			command.uiItems.push( result );

		return result;
	}
795880
def add_commands(cmds):
    
    if not isinstance(cmds, Iterable):
        cmds = [cmds]

    for command in cmds:
        if command.__name__.endswith("Command"):
            globals()[command.__name__] = command
347183
def parent(self, parent):
        
        self._parent = parent
        if parent:
            pctx = dict((x, getattr(parent, x)) for x in parent.context_keys)
            self.inject_context(pctx)
            self.depth = parent.depth + 1
            for command in self.subcommands.values():
                command.parent = self  # bump.
        else:
            self.depth = 0
246591
def set_subcommands(func, parser):
    
    if hasattr(func, '__subcommands__') and func.__subcommands__:
        sub_parser = parser.add_subparsers(
            title=SUBCOMMANDS_LIST_TITLE, dest='subcommand',
            description=SUBCOMMANDS_LIST_DESCRIPTION.format(
                func.__cmd_name__),
            help=func.__doc__)
        for sub_func in func.__subcommands__.values():
            parser = get_parser(sub_func, sub_parser)
            for args, kwargs in get_shared(sub_func):
                parser.add_argument(*args, **kwargs)
    else:
        for args, kwargs in get_shared(func):
            parser.add_argument(*args, **kwargs)
270334
def get_subcommand_kwargs(mgr, name, namespace):
    
    subcmd = mgr.get(name)
    subcmd_kwargs = {}
    for opt in list(subcmd.args.values()) + list(subcmd.options.values()):
        if hasattr(namespace, opt.dest):
            subcmd_kwargs[opt.dest] = getattr(namespace, opt.dest)
    return (subcmd, subcmd_kwargs)
509049
def storage_command(self, name, method_name=None, command_type=None, oauth=False, generic_update=None, **kwargs):
        
        if generic_update:
            command_name = '{} {}'.format(self.group_name, name) if self.group_name else name
            self.generic_update_command(name, **kwargs)
        elif command_type:
            command_name = self.command(name, method_name, command_type=command_type, **kwargs)
        else:
            command_name = self.command(name, method_name, **kwargs)
        self._register_data_plane_account_arguments(command_name)
        if oauth:
            self._register_data_plane_oauth_arguments(command_name)
810020
def alias_command(alias_name, name, *args)
      @commands[alias_name.to_s] = command name
      @aliases[alias_name.to_s] = args
    end
688511
def add_command(self, handler, name=None):
        
        if name is None:
            name = docstring_to_subcommand(handler.__doc__)

        # TODO: Prevent overwriting 'help'?
        self._commands[name] = handler
597726
function(name) {
    var command;
    if (name) {
      command = this.commands[name] = {
        name: name,
        specs: {}
      };
    }
    else {
      command = this.fallback = {
        specs: {}
      };
    }

    // facilitates command('name').options().cb().help()
    var chain = {
      options : function(specs) {
        command.specs = specs;
        return chain;
      },
      opts : function(specs) {
        // old API
        return this.options(specs);
      },
      option : function(name, spec) {
        command.specs[name] = spec;
        return chain;
      },
      callback : function(cb) {
        command.cb = cb;
        return chain;
      },
      help : function(help) {
        command.help = help;
        return chain;
      },
      usage : function(usage) {
        command._usage = usage;
        return chain;
      }
    };
    return chain;
  }
682094
def command(self, group=None, help="", name=None):
        """"""
        def decorator(func):
            return self.add_command(func, group=group, help=help, name=name)
        return decorator
930220
def add_command(self, func, name=None, doc=None):
        
        command = Command(func, doc)
        name = name or func.__name__
        self._commands[name] = command