1pub mod preview;
2pub mod render;
3
4use clap::{Parser, Subcommand};
5
6#[derive(Parser, Clone, Default)]
7pub struct Args {
8 #[arg(global = true, short, long, help_heading = "Cargo Options")]
9 pub package: Option<String>,
10
11 #[arg(trailing_var_arg = true, allow_hyphen_values = true)]
12 pub args: Vec<String>,
13}
14
15#[derive(Parser)]
16#[command(name = "ranim")]
17#[command(about = "A CLI tool for Ranim animation library")]
18#[command(version)]
19pub struct Cli {
20 #[command(subcommand)]
21 command: Commands,
22
23 #[command(flatten)]
24 pub args: Args,
25}
26
27impl Cli {
28 pub fn run(self) {
29 let args = self.args;
30
31 match self.command {
32 Commands::Preview => {
33 preview::preview_command(&args);
34 }
35 Commands::Render { scenes } => {
36 render::render_command(&args, &scenes);
37 }
38 }
39 }
40}
41
42#[derive(Subcommand)]
43pub enum Commands {
44 Preview,
46 Render {
48 #[arg(num_args = 0..)]
50 scenes: Vec<String>,
51 },
52}