/*
    This file is part of jellything (https://codeberg.org/metamuffin/jellything)
    which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
    Copyright (C) 2026 metamuffin <metamuffin.org>
*/
use clap::{CommandFactory, Parser, ValueEnum};
use clap_complete::{generate_to, Shell};
use jellytool::cli;
use std::{fs::create_dir_all, path::PathBuf};

#[derive(Parser)]
struct Args {
    out_dir: PathBuf,
}

fn main() -> anyhow::Result<()> {
    let args = Args::parse();
    create_dir_all(&args.out_dir)?;
    for &shell in Shell::value_variants() {
        generate_to(shell, &mut cli::Args::command(), "jellytool", &args.out_dir)?;
    }
    Ok(())
}
