List CLI commands
        @type   ctx:    Context
        @rtype: list
542532
def list_commands(self, ctx):
        
        commands_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'commands')
        command_list = [name for __, name, ispkg in pkgutil.iter_modules([commands_path]) if ispkg]
        command_list.sort()
        return command_list
1353469
def get_all_subcommands(self):
        
        subcommands = []
        for command in self.descrip:
            for word in command.split():
                for kid in self.command_tree.children:
                    if word != kid and word not in subcommands:
                        subcommands.append(word)
        return subcommands
774566
def _ctxs(self):
        
        return [self._tab_widget.widget(index).context for index in range(0, self._tab_widget.count())]
681935
def commands(scope):
    
    if inspect.ismodule(scope):
        scope = vars(scope)

    return [cmd for cmd in scope.values() if isinstance(cmd, climethod)]
547530
def help(context, command):
    ''''''
    if command:
        cmd = cli.commands.get(command, None)
        if cmd:
            context.info_name = command
            click.echo(cmd.get_help(context))
        else:
            raise click.ClickException('no command: %s' % command)
    else:
        click.echo(cli.get_help(context))
337200
def _list(self, args):
        '''
        
        '''
        args.pop(0)
        command = args[0]
        if command == 'packages':
            self._list_packages(args)
        elif command == 'files':
            self._list_files(args)
        elif command == 'repos':
            self._repo_list(args)
        else:
            raise SPMInvocationError('Invalid list command \'{0}\''.format(command))
804433
def list_commands(self, *path):
        """"""
        path_str = ':'.join(path)

        commands = []
        for command in self.commands:

            # Filter based on prefix and the segment length
            if all([command.startswith(path_str),
                    len(path) == command.count(":")]):

                # offset is used to exclude the path that the caller requested.
                offset = len(path_str) + 1 if path_str else 0
                commands.append(command[offset:])

        return sorted(commands)
437886
function commandListTitle(command, context) {
  const url  = (context === 'README') ? `/docs/commands/${command}.md` : `/commands/${command}`
  // const url  = (context === 'README') ? `/docs/${command}.md` : `/${command}`
  return `### [${command}](${url})${newLine}`
}
127226
def cmd_ls(self, *args):
        
        cmd_str = ' '.join(['ls'] + list(args))
        self.plugin.exec_shell(cmd_str)
239024
def cli(ctx):
    
    level = logger.level
    try:
        level_to_name = logging._levelToName
    # Fallback to pre-Python 3.4 internals.
    except AttributeError:
        level_to_name = logging._levelNames
    level_name = level_to_name.get(level, level)
    logger.debug('Verbosity set to {}.'.format(level_name))

    # Print help screen and exit if no sub-commands provided.
    if ctx.invoked_subcommand is None:
        click.echo(ctx.get_help())
        ctx.exit()

    # Load up global options to the context.
    ctx.obj = {}
887240
def role_list_command(role_command)
      role_command.desc _('cli.role.list.desc')
      role_command.command :list do |role_list_command|
        role_list_command.action do |global_options,options,args|
          roles = Bebox::Role.list(project_root)
          title _('cli.role.list.current_roles')
          roles.map{|role| msg(role)}
          warn(_('cli.role.list.no_roles')) if roles.empty?
          linebreak
        end
      end
    end
97395
def resolve_ctx(cli, prog_name, args):
    
    ctx = cli.make_context(prog_name, args, resilient_parsing=True)
    args = ctx.protected_args + ctx.args
    while args:
        if isinstance(ctx.command, MultiCommand):
            if not ctx.command.chain:
                cmd_name, cmd, args = ctx.command.resolve_command(ctx, args)
                if cmd is None:
                    return ctx
                ctx = cmd.make_context(cmd_name, args, parent=ctx,
                                       resilient_parsing=True)
                args = ctx.protected_args + ctx.args
            else:
                # Walk chained subcommand contexts saving the last one.
                while args:
                    cmd_name, cmd, args = ctx.command.resolve_command(ctx, args)
                    if cmd is None:
                        return ctx
                    sub_ctx = cmd.make_context(cmd_name, args, parent=ctx,
                                               allow_extra_args=True,
                                               allow_interspersed_args=False,
                                               resilient_parsing=True)
                    args = sub_ctx.args
                ctx = sub_ctx
                args = sub_ctx.protected_args + sub_ctx.args
        else:
            break
    return ctx
1065288
def _cli_command(commands,
                 method='cli',
                 **kwargs):
    '''
    
    '''
    if not isinstance(commands, (list, tuple)):
        commands = [commands]
    rpc_responses = rpc(commands,
                        method=method,
                        **kwargs)
    txt_responses = []
    for rpc_reponse in rpc_responses:
        error = rpc_reponse.get('error')
        if error:
            cmd = rpc_reponse.get('command')
            if 'data' in error:
                msg = 'The command "{cmd}" raised the error "{err}".'.format(cmd=cmd, err=error['data']['msg'])
                raise SaltException(msg)
            else:
                msg = 'Invalid command: "{cmd}".'.format(cmd=cmd)
                raise SaltException(msg)
        txt_responses.append(rpc_reponse['result'])
    return txt_responses
37601
def help(self, event, command_name=None):
        
        if command_name is None:
            return ("Type !commands for a list of all commands. Type "
                    "!help [command] to see help for a specific command.")
        try:
            command = self.commands_dict()[command_name]
        except KeyError:
            return "%s is not a command" % command_name

        argspec = getargspec(command)
        args = argspec.args[2:]
        defaults = argspec.defaults or []
        for i in range(-1, -len(defaults) - 1, -1):
            args[i] = "%s [default: %s]" % (args[i], defaults[i])
        args = ", ".join(args)
        help = getdoc(command).replace("\n", " ")
        return "help for %s: (args: %s) %s" % (command_name, args, help)
1285714
def from_list(commands):
    
    def subtrees(commands, level):
        if not commands:
            return

        acc = []
        parent, *commands = commands

        for command in commands:
            if command['level'] > level:
                acc.append(command)
            else:
                yield (parent, acc)
                parent = command
                acc.clear()
        yield (parent, acc)

    def walk(commands, level=0):
        return [
            {
                'description': key['description'],
                'children': walk(subtree, level + 1),
                'id': key['id']
            }
            for key, subtree in subtrees(commands, level)
        ]

    return walk(commands)
1179854
def list_commands(self, **kwargs):
        
        commands = self._commands

        command_id = kwargs.get('CommandId', None)
        if command_id:
            commands = [self.get_command_by_id(command_id)]
        instance_id = kwargs.get('InstanceId', None)
        if instance_id:
            commands = self.get_commands_by_instance_id(instance_id)

        return {
            'Commands': [command.response_object() for command in commands]
        }
340632
def _send_command_list(self, commands):
        """"""
        output = ""
        for command in commands:
            output += self.device.send_command(
                command, strip_prompt=False, strip_command=False
            )
        return output