public static void Main()

in tools/apiParser/src/Program.cs [17:131]


        public static void Main(string[] args)
        {
            if (args.Length != 1 && args.Length != 2 && args.Length != 3)
            {
                Console.WriteLine("Usage: ApiParser.exe docsFolder");
                Console.WriteLine("       ApiParser.exe apiXmlPath version");
                Console.WriteLine("       ApiParser.exe docsFolder apiXmlPath version");
                Console.WriteLine();
                Console.WriteLine("ApiParser.exe docsFolder");
                Console.WriteLine("  Parse all documentation installed by Unity Hub, as well as everything in the docsFolder and create a new api.xml");
                Console.WriteLine();
                Console.WriteLine("  docsFolder - folder that contains multiple versions of Unity docs");
                Console.WriteLine("               Contents should be in the format Documentation-X.Y.ZfA/Documentation/CountryCode/ScriptReference");
                Console.WriteLine();
                Console.WriteLine("ApiParser.exe apiXmlPath version");
                Console.WriteLine("  Parse the installed documentation corresponding to version and merge into an existing api.xml file");
                Console.WriteLine();
                Console.WriteLine("  apiXmlPath - location of api.xml to read and merge into");
                Console.WriteLine("  version - version of Unity to read docs from. Must be installed in standard Unity Hub location");
                Console.WriteLine();
                Console.WriteLine("ApiParser.exe docsFolder apiXmlPath version");
                Console.WriteLine("  Parse the installed documentation corresponding to version and merge into an existing api.xml file");
                Console.WriteLine();
                Console.WriteLine("  docsFolder - folder that contains multiple versions of Unity docs");
                Console.WriteLine("               Contents should be in the format Documentation-X.Y.ZfA/Documentation/CountryCode/ScriptReference");
                Console.WriteLine("  apiXmlPath - location of api.xml to read and merge into");
                Console.WriteLine("  version - version of Unity to read docs from.");
                Console.WriteLine();
                Console.WriteLine("Note that the output file is written to the current directory");
                return;
            }

            var stopwatch = Stopwatch.StartNew();
            var apiXml = FileSystemPath.Parse("api.xml");
            
            var docFolders = new List<FileSystemPath>();
            if (args.Length == 1)
            {
                Directory.SetCurrentDirectory(args[0]);
                docFolders.AddRange(FileSystemPath.Parse(args[0]).GetDirectoryEntries("*", PathSearchFlags.ExcludeFiles).Select(a=>a.GetAbsolutePath()));

                var unityPathInProgramFiles = Path.Combine(
                    Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Unity", "Hub", "Editor");
                if (Directory.Exists(unityPathInProgramFiles))
                    docFolders.AddRange(Directory.EnumerateDirectories(unityPathInProgramFiles)
                        .Select(GetDocumentationRoot));
            }
            else if (args.Length == 2)
            {
                apiXml = FileSystemPath.ParseRelativelyTo(args[0], FileSystemPath.Parse(Directory.GetCurrentDirectory()));
                if (!apiXml.ExistsFile)
                    throw new InvalidOperationException("api.xml path does not exist");

                var requiredVersion = args[1];
                var docFolder = GetDocumentationRoot(requiredVersion);
                if (!docFolder.ExistsDirectory)
                    throw new InvalidOperationException($"Cannot find locally installed docs: {docFolder}");
                docFolders.Add(docFolder);
            }
            else
            {
                Directory.SetCurrentDirectory(args[0]);
                docFolders.AddRange(FileSystemPath.Parse(args[0]).GetDirectoryEntries("*", PathSearchFlags.ExcludeFiles).Select(a=>a.GetAbsolutePath()));
                
                apiXml = FileSystemPath.ParseRelativelyTo(args[1], FileSystemPath.Parse(Directory.GetCurrentDirectory()));
                if (!apiXml.ExistsFile)
                    throw new InvalidOperationException("api.xml path does not exist");

                var requiredVersion = args[2];
                // todo: search requiredVersion among GetDocumentationRoot(requiredVersion);
            }

            var docVersions = new List<(FileSystemPath, Version, RiderSupportedLanguages)>();
            foreach (var docFolder in docFolders)
            {
                var directoryName = docFolder.Name;
                var version = Regex.Match(directoryName, @"Documentation-(\d+.\d+)").Groups[1].Value;
                var langFolders = docFolder.Combine("Documentation").GetChildren();
                foreach (var folder in langFolders)
                {
                    docVersions.Add((folder.GetAbsolutePath(), Version.Parse(version), LocalizationUtil.TranslateCountryCodeIntoLanguageCode(folder.GetAbsolutePath().Name)));    
                }
            }
                
            docVersions = docVersions.OrderBy(v => v.Item2).ToList();
            
            var unityApi = new UnityApi();
            if (apiXml.ExistsFile)
                unityApi = UnityApi.ImportFrom(apiXml);
            var typeResolver = new TypeResolver();
            var parser = new ApiParser(unityApi, typeResolver);

            foreach (var (name, version, langCode) in docVersions)
            {
                Console.WriteLine($"{name} ({version}) {langCode}");
                parser.ParseFolder(name.FullPath, version, langCode);

                AddUndocumentedApis(unityApi, version);
            }

            // These modify existing functions
            AddUndocumentedOptionalParameters(unityApi);
            AddUndocumentedCoroutines(unityApi);
            FixDataFromIncorrectDocs(unityApi, typeResolver);

            using (var writer = new XmlTextWriter(apiXml.FullPath, Encoding.UTF8) {Formatting = Formatting.Indented})
            {
                parser.ExportTo(writer);
            }

            Console.WriteLine("Done. Elapsed time: {0}", stopwatch.Elapsed);

            // Console.WriteLine( "Press <Enter> key to continue..." );
            // Console.ReadLine();
        }