forked from
stavola.xyz/mlf
A human-friendly DSL for ATProto Lexicons
1// This example demonstrates how to use MLF codegen plugins
2//
3// To run with all plugins loaded:
4// cargo run --example list_generators --features="typescript,go,rust"
5
6use mlf_codegen::plugin;
7
8fn main() {
9 println!("MLF Code Generator Plugins\n");
10 println!("===========================\n");
11
12 let generators = plugin::generators();
13
14 if generators.is_empty() {
15 println!("No generators registered!");
16 println!("\nTo use plugins, depend on them in your Cargo.toml:");
17 println!(" mlf-codegen-typescript = {{ path = \"../codegen-plugins/mlf-codegen-typescript\" }}");
18 println!(" mlf-codegen-go = {{ path = \"../codegen-plugins/mlf-codegen-go\" }}");
19 println!(" mlf-codegen-rust = {{ path = \"../codegen-plugins/mlf-codegen-rust\" }}");
20 } else {
21 println!("Found {} generator(s):\n", generators.len());
22
23 for generator in generators {
24 println!(" {} ({}):",
25 generator.name(),
26 generator.file_extension()
27 );
28 println!(" {}\n", generator.description());
29 }
30 }
31}