mirror of
				https://github.com/davidgiven/fluxengine.git
				synced 2025-10-24 11:11:02 -07:00 
			
		
		
		
	First draft at autogenerating the table in the README.
This commit is contained in:
		
							
								
								
									
										55
									
								
								scripts/mkdocindex.cc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										55
									
								
								scripts/mkdocindex.cc
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,55 @@ | ||||
| #include "lib/globals.h" | ||||
| #include "lib/proto.h" | ||||
| #include "lib/flags.h" | ||||
| #include <fmt/format.h> | ||||
|  | ||||
| extern const std::map<std::string, const ConfigProto*> formats; | ||||
|  | ||||
| int main(int argc, const char* argv[]) | ||||
| { | ||||
| 	fmt::print("<!-- FORMATSSTART -->\n"); | ||||
| 	fmt::print("<!-- This section is automatically generated. Do not edit. -->\n"); | ||||
| 	fmt::print("| Profile | Format | Read? | Write? | Filesystem? |\n"); | ||||
| 	fmt::print("|:--------|:------:|:-----:|:------:|-------------|\n"); | ||||
|  | ||||
| 	for (auto [name, config] : formats) | ||||
| 	{ | ||||
| 		if (config->is_extension()) | ||||
| 			continue; | ||||
|  | ||||
| 		std::set<std::string> filesystems; | ||||
| 		auto addFilesystem = [&](const FilesystemProto& fs) { | ||||
| 			if (fs.type() != FilesystemProto::NOT_SET) | ||||
| 			{ | ||||
| const auto *descriptor = FilesystemProto::FilesystemType_descriptor(); | ||||
| auto name = descriptor->FindValueByNumber(fs.type())->name(); | ||||
|  | ||||
| 				filesystems.insert(name); | ||||
| 				} | ||||
| 		}; | ||||
|  | ||||
| 		addFilesystem(config->filesystem()); | ||||
| 		for (const auto& group : config->option_group()) | ||||
| 		{ | ||||
| 			for (const auto& option : group.option()) | ||||
| 				addFilesystem(option.config().filesystem()); | ||||
| 		} | ||||
| 		for (const auto& option : config->option()) | ||||
| 			addFilesystem(option.config().filesystem()); | ||||
|  | ||||
| 		std::stringstream ss; | ||||
| 		for (auto& fs : filesystems) | ||||
| 			ss << fs << " "; | ||||
|  | ||||
| 		fmt::print("| {} | {} | {} | {} | {} |\n", | ||||
| 			name, config->comment(), | ||||
| 				config->has_decoder() ? "YES" : "", | ||||
| 				config->has_encoder() ? "YES" : "", | ||||
| 				ss.str()); | ||||
| 	} | ||||
|  | ||||
| 	std::cout << "{: .datatable }\n"; | ||||
| 	fmt::print("<!-- FORMATSEND -->\n"); | ||||
|     return 0; | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user