def find_commands(parent=None,
                  name_filter=None,
                  description_filter=None,
                  exact_name=None):
    '''
    Returns all commands.
    If any filter specified, it filter those commands.

    @keyword str parent: only return commands that their parrents
        matches this string.
    @keyword str name_filter: only return commands that their names
        contain this string.
    @keyword str exact_name: only return command that its name
        is this string.
    @keyword str description_filter: only return commands that their
        description contain this string.

    @return: founded commands
    @rtype: list(dict(str name,
                      str description))
    '''

    commands = commander.get_commands(parent=parent,
                                      name_filter=name_filter,
                                      description_filter=description_filter,
                                      exact_name=exact_name)

    return [{
        'name': cmd.get_name(),
        'description': cmd.get_description()
    } for cmd in commands]
def get_commands_names(parent=None):
    '''
    Returns all command in the given parent domain.
    
    @param parent: parent name
    @return: list<Command>
    '''

    return [command.get_name() for command in commander.get_commands(parent)]
Exemple #3
0
    def _get_all_commands(self):
        '''
        Returns all of application commands
        
        @rtype: [str]
        @return: command list
        '''

        result = []
        
        for command in commander_services.get_commands():
            result.append(command.get_key())
            
        return result
Exemple #4
0
    def get_command_list(self, parent = None): 
        '''
        Returns available commands list.
        
        @param parent: parent command
        
        @rtype: [str]
        @return: command list
        '''
        
        result = []
        for command in commander_services.get_commands(parent):
            result.append(command.get_key())

        if not channel_services.is_enable():
            return result
        
        allowed = self.get_channel_authorized_commands(get_current_channel_id())
        return list(set(allowed).intersection(set(result)))