diff options
| author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-11-07 15:00:04 +0100 |
|---|---|---|
| committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2026-11-07 15:00:04 +0100 |
| commit | 73cc6d79192ce1cd7851f990b2666c354d105939 (patch) | |
| tree | f5efead8659d64a7e835d9680942a52d209ebc9b /crates/mk_config/src/lib.rs | |
| parent | refactor(yt_dlp/): Make the options more like the builder pattern (diff) | |
| download | yt-73cc6d79192ce1cd7851f990b2666c354d105939.zip | |
feat(yt/{cli,config}): Rewrite the config generation macro
That now is both cleaner and supports config overrides
(i.e. `yt --option NAME VALUE`).
Diffstat (limited to 'crates/mk_config/src/lib.rs')
| -rw-r--r-- | crates/mk_config/src/lib.rs | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/crates/mk_config/src/lib.rs b/crates/mk_config/src/lib.rs new file mode 100644 index 0000000..0686b27 --- /dev/null +++ b/crates/mk_config/src/lib.rs @@ -0,0 +1,19 @@ +use proc_macro::TokenStream; +use quote::quote; +use syn::parse_macro_input; + +use crate::parse::ParseBase; + +mod generate; +mod parse; + +#[proc_macro] +pub fn mk_config(input: TokenStream) -> TokenStream { + // eprintln!("{}", input); + let parsed = parse_macro_input!(input as ParseBase); + + let config = generate::Config::from(parsed); + let expanded = quote! {#config}; + + TokenStream::from(expanded) +} |
