palette-bin 0.1.0

Apply an ACT palette to and optionally resize an image
Documentation
use crate::RatioMode;
use clap::{Parser, Subcommand};
use std::path::PathBuf;

#[derive(Subcommand, Debug)]
pub enum Commands {
    /// Resize an image
    Resize {
        /// Resize ratio mode
        #[clap(short = 'r', long, value_enum, default_value_t = RatioMode::Crop)]
        ratio_mode: RatioMode,

        /// Output image width
        #[clap(long, default_value_t = 800)]
        width: u32,

        /// Output image height
        #[clap(long, default_value_t = 480)]
        height: u32,
    },

    /// Apply a palette (ACT file) to an image
    Palette {
        /// Palette file (ACT)
        #[clap(short, long, value_parser = clap::value_parser!(PathBuf))]
        palette: PathBuf,
    },

    Test {},
}

/// Applies an .act color palette to an image, resizes it, and saves it as a bitmap.
#[derive(Parser, Debug)]
#[clap(version, about, long_about = None)]
pub struct Cli {
    /// Input image file
    #[clap(short, long, value_parser = clap::value_parser!(PathBuf))]
    pub input: PathBuf,

    /// Output image file
    #[clap(short, long, default_value = "output.bmp", value_parser = clap::value_parser!(PathBuf))]
    pub output: PathBuf,

    #[clap(subcommand)]
    pub command: Commands,
}