public static void Main(string[] args) { Console.WriteLine("Sharptiles documentation generation"); if (args.Length != 1 && args.Length != 2) { throw new ArgumentException("Usage " + ASSEMLBY_NAME + " <documentation target path> [--json]"); } var json = false; var targetPath = args[0]; if (args.Length == 2 && args[1].Equals("--json")) { json = true; } Console.WriteLine($"Generating to {targetPath}"); var generator = new DocumentationGenerator() .For(Scope) .AddSpecial(HandleHtmlTags); // generator.CopyFiles(targetPath, templatePath); try { if (json) { var documentation = generator.BuildModel(); var result = JsonConvert.SerializeObject(documentation, Formatting.Indented, new TypeJsonConverter(), new StringEnumConverter()); File.WriteAllText(targetPath, result); } else { var documentation = generator.GenerateDocumentation(); File.WriteAllText(targetPath, documentation); } } catch (ExceptionWithContext EWC) { Console.WriteLine(EWC.Message); Console.WriteLine(EWC.Context); } Console.WriteLine("Finished"); }