Prints usage of all registered commands, collapsing aliases
        into one record
962264
def print_help(self):
        
        seen_aliases = set()
        print('-'*80)
        for cmd in sorted(self.cmds):
            if cmd not in self.builtin_cmds:
                if cmd not in seen_aliases:
                    if cmd in self.aliases:
                        seen_aliases.update(self.aliases[cmd])
                        disp = '/'.join(self.aliases[cmd])
                    else:
                        disp = cmd
                    _, parser = self.cmds[cmd]
                    usage = parser.format_usage()
                    print('%s: %s' % (disp, ' '.join(usage.split()[2:])))
        print('External CLIs: %s' % ', '.join(sorted(self.clis)))
775951
def Alias(self, alias):
        """"""
        # FIXME
        if self.generate_comments:
            self.print_comment(alias)
        print("%s = %s # alias" % (alias.name, alias.alias), file=self.stream)
        self._aliases += 1
        return
486411
public function printSummary() {
    drush_print();

    // Print env files used for this definition.
    drush_print($this->formatHeading('Environment Definitions Found'));
    foreach ($this->loadedEnvs as $filename) {
      drush_print("{$filename}", 1);
    }

    drush_print();
    drush_print($this->formatHeading(dt("CONFIGURATION SUMMARY")));

    // We want to make sure they are printed in the same order as they will run.
    foreach ($this->getActiveDefinition() as $group => $options) {
      // Print a nice heading.
      $heading = $this->formatHeading($group);

      switch (strtolower($group)) {
        case 'modules':
          $this->printModuleSummary($options, $heading);
          break;

        case 'variables':
          $this->printVariableSummary($options, $heading);
          break;

        case 'permissions':
          $this->printPermissionSummary($options, $heading);
          break;

        case 'commands':
          $this->printCommandSummary($options, $heading);
          break;

        default:
          drush_print($this->formatHeading($group));
          drush_log(dt("I'm not sure what to do with '@group'.", ['@group' => $group]), 'warning');
          break;
      }
    }
  }
130026
public function printUsage() {
        $commandList = [];

        foreach ($this->config['commands'] as $command => $commandOptions) {
            $separator = 20 - strlen($command);

            $commandList[] = '    ' . $command . str_pad(' ', $separator) .
                '<dim>' . $commandOptions['description'] . '</dim>';
        }

        sort($commandList);

        $this->log->info(
            <<< EOF
%1\$s: %3\$s

<strong>VERSION</strong>
    %4\$s

<strong>USAGE</strong>
    \$ %1\$s [COMMAND] [OPTIONS]

<strong>COMMANDS</strong>
%2\$s

    <dim># Print usage of a command:</dim>
    \$ %1\$s help COMMAND
    <dim># or:</dim>
    \$ %1\$s COMMAND --help
    <dim># List all commands:</dim>
    \$ %1\$s list

<strong>COMMON OPTIONS</strong>
    -c <u>FILE</u>,            <dim>Include settings stored in a JSON-formatted</dim>
    --config=<u>FILE</u>       <dim>configuration file FILE; repeat option for more</dim>
                        <dim>than one FILE</dim>
    -s <u>KEY=VALUE</u>,       <dim>Add runtime setting KEY with its VALUE; separate</dim>
    --setting=<u>KEY=VALUE</u> <dim>nested keys with ".", for example "key1.key2=123";</dim>
                        <dim>repeat option for more than one KEY</dim>

    --no-colors         <dim>Do not print colored messages</dim>
    -q, --quiet         <dim>Do not output messages, only errors</dim>
    -v, --verbose       <dim>Be more verbose</dim>

    -h, --help          <dim>Print this help or information about a</dim>
                        <dim>specific command</dim>
    --version           <dim>Print version information</dim>

<strong>FIRST STEPS</strong>
    <dim># %5\$s:</dim>
    %1\$s init
    <dim># %6\$s:</dim>
    %1\$s configtest
EOF
            ,
            $this->config['composer']['extra']['name'],
            implode(PHP_EOL, $commandList),
            $this->config['composer']['description'],
            $this->config['composer']['extra']['version'],
            $this->config['commands']['init']['description'],
            $this->config['commands']['configtest']['description']
        );

        return $this;
    }
1358260
def join
      commands = []

      @history.each do |command|
        program = command[0]
        arguments = command[1..-1].map { |word| shellescape(word.to_s) }

        commands << [program, *arguments].join(' ')
      end

      return commands.join(' && ')
    end
489183
def alias_list
      lines = normalize_array(rvm(:alias, :list).stdout)
      lines.inject({}) do |acc, current|
        alias_name, ruby_string = current.to_s.split(" => ")
        unless alias_name.empty? || ruby_string.empty?
          acc[alias_name] = ruby_string
        end
        acc
      end
    end
268184
def print_info(self):
        """"""
        
        d = dir(self)
        self.plugins = []
        for key in d:
            if key.startswith("info_"):
                self.plugins.append(key)

        for key in self.plugins:
            if self.echo:
                Console.ok("> {0}".format(key.replace("_", " ", 1)))
            exec("self.%s()" % key)
401104
def print_help(self, session, command=None):
        
        if command:
            # Single command mode
            if command in self._commands:
                # Argument is a name space
                self.__print_namespace_help(session, command)
                was_namespace = True
            else:
                was_namespace = False

            # Also print the name of matching commands
            try:
                # Extract command name space and name
                possibilities = self.get_ns_commands(command)
            except ValueError as ex:
                # Unknown command
                if not was_namespace:
                    # ... and no name space were matching either -> error
                    session.write_line(str(ex))
                    return False
            else:
                # Print the help of the found command
                if was_namespace:
                    # Give some space
                    session.write_line("\n\n")

                for namespace, cmd_name in possibilities:
                    self.__print_namespace_help(session, namespace, cmd_name)
        else:
            # Get all name spaces
            namespaces = list(self._commands.keys())
            namespaces.remove(DEFAULT_NAMESPACE)
            namespaces.sort()
            namespaces.insert(0, DEFAULT_NAMESPACE)

            first_ns = True
            for namespace in namespaces:
                if not first_ns:
                    # Add empty lines
                    session.write_line("\n\n")

                # Print the help of all commands
                self.__print_namespace_help(session, namespace)
                first_ns = False

        return None
267416
def dump_commands(commands, directory=None, sub_dir=None):
    
    print('\t' + str(len(commands)), 'failed commands')

    # Create dump_dir directory
    if directory and os.path.isfile(directory):
        dump_dir = set_dump_directory(os.path.dirname(directory), sub_dir)
        return_dir = dump_dir
    elif directory:
        dump_dir = set_dump_directory(directory, sub_dir)
        return_dir = dump_dir
    else:
        dump_dir = TemporaryDirectory().name
        return_dir = TemporaryDirectory()

    # Create list of (path, content) tuples
    command_filepath = [(fail, os.path.join(dump_dir, str(count) + '.sql')) for count, fail in enumerate(commands)]

    # Dump failed commands to text file in the same directory as the commands
    # Utilize's multiprocessing module if it is available
    timer = Timer()
    if MULTIPROCESS:
        pool = Pool(cpu_count())
        pool.map(write_text_tup, command_filepath)
        pool.close()
        print('\tDumped ', len(command_filepath), 'commands\n\t\tTime      : {0}'.format(timer.end),
              '\n\t\tMethod    : (multiprocessing)\n\t\tDirectory : {0}'.format(dump_dir))
    else:
        for tup in command_filepath:
            write_text_tup(tup)
        print('\tDumped ', len(command_filepath), 'commands\n\t\tTime      : {0}'.format(timer.end),
              '\n\t\tMethod    : (sequential)\n\t\tDirectory : {0}'.format(dump_dir))

    # Return base directory of dumped commands
    return return_dir
629709
def logs(sess_id_or_alias):
    '''
    
    '''
    with Session() as session:
        try:
            print_wait('Retrieving container logs...')
            kernel = session.Kernel(sess_id_or_alias)
            result = kernel.get_logs().get('result')
            logs = result.get('logs') if 'logs' in result else ''
            print(logs)
            print_done('End of logs.')
        except Exception as e:
            print_error(e)
            sys.exit(1)
53374
def dump(self):
        """"""
        for modpath in sorted(self.map):
            title = 'Used by %s' % modpath
            print('\n' + title + '\n' + '-'*len(title))
            for origin in sorted(self.get_used_origins(modpath)):
                print('  %s' % origin)
438413
def usage(self, subcommand):
        
        usage = ' '.join(['%prog', subcommand, '[options]'])
        if self.args:
            usage = '%s %s' % (usage, str(self.args))
        return usage
75491
def _transform_cur_commands(cur_commands, alias_table=None):
    
    transformed = []
    alias_table = alias_table if alias_table else get_alias_table()
    for cmd in cur_commands:
        if cmd in alias_table.sections() and alias_table.has_option(cmd, 'command'):
            transformed += alias_table.get(cmd, 'command').split()
        else:
            transformed.append(cmd)
    cur_commands[:] = transformed
227964
def printUnusedImports(self):
        """"""
        for module in self.listModules():
            names = [(unused.lineno, unused.name)
                     for unused in module.unused_names]
            names.sort()
            for lineno, name in names:
                if not self.all_unused:
                    line = linecache.getline(module.filename, lineno)
                    if '#' in line:
                        # assume there's a comment explaining why it's not used
                        continue
                print("%s:%s: %s not used" % (module.filename, lineno, name))
306249
def _get_usage(ctx):
    """"""
    formatter = ctx.make_formatter()
    pieces = ctx.command.collect_usage_pieces(ctx)
    formatter.write_usage(ctx.command_path, ' '.join(pieces), prefix='')
    return formatter.getvalue().rstrip('\n')
452157
public void printUsage(PrintWriter pw, int width, String cmdLineSyntax)
    {
        int argPos = cmdLineSyntax.indexOf(' ') + 1;

        printWrapped(pw, width, getSyntaxPrefix().length() + argPos, getSyntaxPrefix() + cmdLineSyntax);
    }
851698
def get_commands(self):
		
		shutit_global.shutit_global_object.yield_to_draw()
		s = ''
		for c in self.build['shutit_command_history']:
			if isinstance(c, str):
				#Ignore commands with leading spaces
				if c and c[0] != ' ':
					s += c + '\n'
		return s