Skip to main content

palette_bin/
args.rs

1use crate::RatioMode;
2use clap::{Parser, Subcommand};
3use std::path::PathBuf;
4
5#[derive(Subcommand, Debug)]
6pub enum Commands {
7    /// Resize an image
8    Resize {
9        /// Resize ratio mode
10        #[clap(short = 'r', long, value_enum, default_value_t = RatioMode::Crop)]
11        ratio_mode: RatioMode,
12
13        /// Output image width
14        #[clap(long, default_value_t = 800)]
15        width: u32,
16
17        /// Output image height
18        #[clap(long, default_value_t = 480)]
19        height: u32,
20    },
21
22    /// Apply a palette (ACT file) to an image
23    Palette {
24        /// Palette file (ACT)
25        #[clap(short, long, value_parser = clap::value_parser!(PathBuf))]
26        palette: PathBuf,
27    },
28
29    Test {},
30}
31
32/// Applies an .act color palette to an image, resizes it, and saves it as a bitmap.
33#[derive(Parser, Debug)]
34#[clap(version, about, long_about = None)]
35pub struct Cli {
36    /// Input image file
37    #[clap(short, long, value_parser = clap::value_parser!(PathBuf))]
38    pub input: PathBuf,
39
40    /// Output image file
41    #[clap(short, long, default_value = "output.bmp", value_parser = clap::value_parser!(PathBuf))]
42    pub output: PathBuf,
43
44    #[clap(subcommand)]
45    pub command: Commands,
46}