main.rs

 1use anyhow::Result;
 2use clap::{Parser, ValueEnum};
 3use schemars::schema_for;
 4use theme::{IconThemeFamilyContent, ThemeFamilyContent};
 5
 6#[derive(Parser, Debug)]
 7pub struct Args {
 8    #[arg(value_enum)]
 9    pub schema_type: SchemaType,
10}
11
12#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, ValueEnum)]
13#[clap(rename_all = "snake_case")]
14pub enum SchemaType {
15    Theme,
16    IconTheme,
17}
18
19fn main() -> Result<()> {
20    env_logger::init();
21
22    let args = Args::parse();
23
24    match args.schema_type {
25        SchemaType::Theme => {
26            let schema = schema_for!(ThemeFamilyContent);
27            println!("{}", serde_json::to_string_pretty(&schema)?);
28        }
29        SchemaType::IconTheme => {
30            let schema = schema_for!(IconThemeFamilyContent);
31            println!("{}", serde_json::to_string_pretty(&schema)?);
32        }
33    }
34
35    Ok(())
36}