parameters: (self, scriptname, fobj=sys.stdout)
docstring: Prints the documentation for the script and exits.
  
          :param scriptname: the name of the script being executed (argv[0]).
          :param fobj: the file to write the help to. The default is stdout.
docstring_summary: Prints the documentation for the script and exits.
docstring_tokens: Prints the documentation for the script and exits .
function: def print_top_help(self, scriptname, fobj=sys.stdout):
          """
          Prints the documentation for the script and exits.
  
          :param scriptname: the name of the script being executed (argv[0]).
          :param fobj: the file to write the help to. The default is stdout.
          """
          # show global command usage if have one
          if self.globalcommand:
              self.write(fobj, "\n".join(self.return_cmd_doc(self.globalcommand)))
              self.write(fobj, "\n".join(self.return_argnames_doc(self.globalcommand)))
              self.write(fobj, "\n".join(self.return_keyword_doc(self.globalcommand)))
              self.write(fobj, "\n")
   
          # Print the basic help for running a command
          self.write(fobj, "Usage: %s COMMAND <options>\n\n" % scriptname)
  
          # Get a sorted list of all command names
          cmdnames = sorted(self.commands.keys())
          if cmdnames:
              # Calculate the indent for the doc strings by taking the longest
              # command name and adding 3 (one space before the name and two
              # after)
              rindent = max(len(name) for name in cmdnames) + 3
  
              self.write(fobj, "Available commands:\n")
              for cmdname in cmdnames:
                  # Get the Cmd object for this command
                  cmd = self.commands[cmdname]
  
                  self.write(fobj, " " + cmdname)
  
                  # Get the paragraphs of the command's docstring
                  paras = process_docstring(cmd.docstring)
                  if paras:
                      # Calculate the padding necessary to fill from the end of the
                      # command name to the documentation margin
                      tab = " " * (rindent - len(cmdname) - 1)
                      self.write(fobj, tab)
  
                      # Print the first paragraph
                      self.write(fobj, "\n".join(format_paras([paras[0]], 76,
                                                 indent=rindent,
                                                 lstripline=[0])))
                      self.write(fobj, "\n")
                  else:
                      self.write(fobj, "\n")
  
          self.write(fobj, "\n")
          self.write(fobj, "Use '%s <command> --help' for individual command "
                     "help.\n" % scriptname)
function_tokens: def print_top_help ( self , scriptname , fobj = sys . stdout ) : # show global command usage if have one if self . globalcommand : self . write ( fobj , "\n" . join ( self . return_cmd_doc ( self . globalcommand ) ) ) self . write ( fobj , "\n" . join ( self . return_argnames_doc ( self . globalcommand ) ) ) self . write ( fobj , "\n" . join ( self . return_keyword_doc ( self . globalcommand ) ) ) self . write ( fobj , "\n" ) # Print the basic help for running a command self . write ( fobj , "Usage: %s COMMAND <options>\n\n" % scriptname ) # Get a sorted list of all command names cmdnames = sorted ( self . commands . keys ( ) ) if cmdnames : # Calculate the indent for the doc strings by taking the longest # command name and adding 3 (one space before the name and two # after) rindent = max ( len ( name ) for name in cmdnames ) + 3 self . write ( fobj , "Available commands:\n" ) for cmdname in cmdnames : # Get the Cmd object for this command cmd = self . commands [ cmdname ] self . write ( fobj , " " + cmdname ) # Get the paragraphs of the command's docstring paras = process_docstring ( cmd . docstring ) if paras : # Calculate the padding necessary to fill from the end of the # command name to the documentation margin tab = " " * ( rindent - len ( cmdname ) - 1 ) self . write ( fobj , tab ) # Print the first paragraph self . write ( fobj , "\n" . join ( format_paras ( [ paras [ 0 ] ] , 76 , indent = rindent , lstripline = [ 0 ] ) ) ) self . write ( fobj , "\n" ) else : self . write ( fobj , "\n" ) self . write ( fobj , "\n" ) self . write ( fobj , "Use '%s <command> --help' for individual command " "help.\n" % scriptname )