parameters: (self)
return_statement: return 0
docstring: Command entry point for the help command.
docstring_summary: Command entry point for the help command.
docstring_tokens: Command entry point for the help command .
function: def RunCommand(self):
      """Command entry point for the help command."""
      (help_type_map, help_name_map) = self._LoadHelpMaps()
      output = []
      if not self.args:
        output.append('%s\nAvailable commands:\n' % top_level_usage_string)
        format_str = '  %-' + str(MAX_HELP_NAME_LEN) + 's%s\n'
        for help_prov in sorted(help_type_map['command_help'],
                                key=lambda hp: hp.help_spec.help_name):
          output.append(format_str % (
              help_prov.help_spec.help_name,
              help_prov.help_spec.help_one_line_summary))
        output.append('\nAdditional help topics:\n')
        for help_prov in sorted(help_type_map['additional_help'],
                                key=lambda hp: hp.help_spec.help_name):
          output.append(format_str % (
              help_prov.help_spec.help_name,
              help_prov.help_spec.help_one_line_summary))
        output.append('\nUse gsutil help <command or topic> for detailed help.')
      else:
        invalid_subcommand = False
        arg = self.args[0]
        if arg not in help_name_map:
          output.append('No help available for "%s"' % arg)
        else:
          help_prov = help_name_map[arg]
          help_name = None
          if len(self.args) > 1:  # We also have a subcommand argument.
            subcommand_map = help_prov.help_spec.subcommand_help_text
            if subcommand_map and self.args[1] in subcommand_map:
              help_name = arg + ' ' + self.args[1]
              help_text = subcommand_map[self.args[1]]
            else:
              invalid_subcommand = True
              if not subcommand_map:
                output.append((
                    'The "%s" command has no subcommands. You can ask for the '
                    'full help by running:\n\n\tgsutil help %s\n') %
                              (arg, arg))
              else:
                subcommand_examples = []
                for subcommand in subcommand_map:
                  subcommand_examples.append(
                      '\tgsutil help %s %s' % (arg, subcommand))
                output.append(
                    ('Subcommand "%s" does not exist for command "%s".\n'
                     'You can either ask for the full help about the command by '
                     'running:\n\n\tgsutil help %s\n\n'
                     'Or you can ask for help about one of the subcommands:\n\n%s'
                    ) % (self.args[1], arg, arg, '\n'.join(subcommand_examples)))
          if not invalid_subcommand:
            if not help_name:  # No subcommand or invalid subcommand.
              help_name = help_prov.help_spec.help_name
              help_text = help_prov.help_spec.help_text
  
            output.append('<B>NAME</B>\n')
            output.append('  %s - %s\n' % (
                help_name, help_prov.help_spec.help_one_line_summary))
            output.append('\n\n')
            output.append(help_text.strip('\n'))
            new_alias = OLD_ALIAS_MAP.get(arg, [None])[0]
            if new_alias:
              deprecation_warning = """
    The "%s" alias is deprecated, and will eventually be removed completely.
    Please use the "%s" command instead.""" % (arg, new_alias)
  
              output.append('\n\n\n<B>DEPRECATION WARNING</B>\n')
              output.append(deprecation_warning)
      self._OutputHelp(''.join(output))
      return 0
function_tokens: def RunCommand ( self ) : ( help_type_map , help_name_map ) = self . _LoadHelpMaps ( ) output = [ ] if not self . args : output . append ( '%s\nAvailable commands:\n' % top_level_usage_string ) format_str = '  %-' + str ( MAX_HELP_NAME_LEN ) + 's%s\n' for help_prov in sorted ( help_type_map [ 'command_help' ] , key = lambda hp : hp . help_spec . help_name ) : output . append ( format_str % ( help_prov . help_spec . help_name , help_prov . help_spec . help_one_line_summary ) ) output . append ( '\nAdditional help topics:\n' ) for help_prov in sorted ( help_type_map [ 'additional_help' ] , key = lambda hp : hp . help_spec . help_name ) : output . append ( format_str % ( help_prov . help_spec . help_name , help_prov . help_spec . help_one_line_summary ) ) output . append ( '\nUse gsutil help <command or topic> for detailed help.' ) else : invalid_subcommand = False arg = self . args [ 0 ] if arg not in help_name_map : output . append ( 'No help available for "%s"' % arg ) else : help_prov = help_name_map [ arg ] help_name = None if len ( self . args ) > 1 : # We also have a subcommand argument. subcommand_map = help_prov . help_spec . subcommand_help_text if subcommand_map and self . args [ 1 ] in subcommand_map : help_name = arg + ' ' + self . args [ 1 ] help_text = subcommand_map [ self . args [ 1 ] ] else : invalid_subcommand = True if not subcommand_map : output . append ( ( 'The "%s" command has no subcommands. You can ask for the ' 'full help by running:\n\n\tgsutil help %s\n' ) % ( arg , arg ) ) else : subcommand_examples = [ ] for subcommand in subcommand_map : subcommand_examples . append ( '\tgsutil help %s %s' % ( arg , subcommand ) ) output . append ( ( 'Subcommand "%s" does not exist for command "%s".\n' 'You can either ask for the full help about the command by ' 'running:\n\n\tgsutil help %s\n\n' 'Or you can ask for help about one of the subcommands:\n\n%s' ) % ( self . args [ 1 ] , arg , arg , '\n' . join ( subcommand_examples ) ) ) if not invalid_subcommand : if not help_name : # No subcommand or invalid subcommand. help_name = help_prov . help_spec . help_name help_text = help_prov . help_spec . help_text output . append ( '<B>NAME</B>\n' ) output . append ( '  %s - %s\n' % ( help_name , help_prov . help_spec . help_one_line_summary ) ) output . append ( '\n\n' ) output . append ( help_text . strip ( '\n' ) ) new_alias = OLD_ALIAS_MAP . get ( arg , [ None ] ) [ 0 ] if new_alias : deprecation_warning = """
    The "%s" alias is deprecated, and will eventually be removed completely.
    Please use the "%s" command instead.""" % ( arg , new_alias ) output . append ( '\n\n\n<B>DEPRECATION WARNING</B>\n' ) output . append ( deprecation_warning ) self . _OutputHelp ( '' . join ( output ) ) return 0