parameters: ()
docstring: Main entry point
docstring_summary: Main entry point
docstring_tokens: Main entry point
function: def main():
      """Main entry point
      """
      success = False
      usage = "%prog [-e <eslint>] [-d] lint|lint-patch|fix [glob patterns] "
      description = "lint runs ESLint on provided patterns or all .js files under jstests/ "\
                    "and src/mongo. lint-patch runs ESLint against .js files modified in the "\
                    "provided patch file (for upload.py). "\
                    "fix runs ESLint with --fix on provided patterns "\
                    "or files under jstests/ and src/mongo."
      epilog ="*Unless you specify -d a separate ESLint process will be launched for every file"
      parser = OptionParser()
      parser = OptionParser(usage=usage, description=description, epilog=epilog)
      parser.add_option("-e", "--eslint", type="string", dest="eslint",
                        help="Fully qualified path to eslint executable",)
      parser.add_option("-d", "--dirmode", action="store_true", default=True, dest="dirmode",
                        help="Considers the glob patterns as directories and runs ESLint process " \
                             "against each pattern",)
  
      (options, args) = parser.parse_args(args=sys.argv)
  
      if len(args) > 1:
          command = args[1]
          searchlist = args[2:]
          if not searchlist:
              searchlist = ["jstests/", "src/mongo/"]
  
          if command == "lint":
              success = lint(options.eslint, options.dirmode, searchlist)
          elif command == "lint-patch":
              if not args[2:]:
                  success = False
                  print("You must provide the patch's fully qualified file name with lint-patch")
              else:
                  success = lint_patch(options.eslint, searchlist)
          elif command == "fix":
              success = autofix_func(options.eslint, options.dirmode, searchlist)
          else:
              parser.print_help()
      else:
          parser.print_help()
  
      sys.exit(0 if success else 1)
function_tokens: def main ( ) : success = False usage = "%prog [-e <eslint>] [-d] lint|lint-patch|fix [glob patterns] " description = "lint runs ESLint on provided patterns or all .js files under jstests/ " "and src/mongo. lint-patch runs ESLint against .js files modified in the " "provided patch file (for upload.py). " "fix runs ESLint with --fix on provided patterns " "or files under jstests/ and src/mongo." epilog = "*Unless you specify -d a separate ESLint process will be launched for every file" parser = OptionParser ( ) parser = OptionParser ( usage = usage , description = description , epilog = epilog ) parser . add_option ( "-e" , "--eslint" , type = "string" , dest = "eslint" , help = "Fully qualified path to eslint executable" , ) parser . add_option ( "-d" , "--dirmode" , action = "store_true" , default = True , dest = "dirmode" , help = "Considers the glob patterns as directories and runs ESLint process " "against each pattern" , ) ( options , args ) = parser . parse_args ( args = sys . argv ) if len ( args ) > 1 : command = args [ 1 ] searchlist = args [ 2 : ] if not searchlist : searchlist = [ "jstests/" , "src/mongo/" ] if command == "lint" : success = lint ( options . eslint , options . dirmode , searchlist ) elif command == "lint-patch" : if not args [ 2 : ] : success = False print ( "You must provide the patch's fully qualified file name with lint-patch" ) else : success = lint_patch ( options . eslint , searchlist ) elif command == "fix" : success = autofix_func ( options . eslint , options . dirmode , searchlist ) else : parser . print_help ( ) else : parser . print_help ( ) sys . exit ( 0 if success else 1 )