yatp_cli/
cli.rs

1use clap::Parser;
2use std::path::PathBuf;
3
4use crate::format;
5
6/// A `clap` parser structure
7#[derive(Debug, Parser)]
8#[clap(
9    about = "Yet Another Texture Packer - a small and simple CLI application to pack \nmultiple textures/sprites into a texture atlas/sprite sheet."
10)]
11#[clap(version = env!("CARGO_PKG_VERSION"))]
12pub struct Cli {
13    /// Input images and folders
14    #[clap(value_parser, help = "Files and folders to pack")]
15    pub inputs: Vec<PathBuf>,
16
17    /// Gap between packed textures
18    #[clap(
19        short,
20        long,
21        value_parser,
22        default_value_t = 0,
23        help = "Gap between packed textures"
24    )]
25    pub gap: u32,
26
27    /// Image format
28    #[clap(short, long, arg_enum, value_parser, default_value_t = format::ImageFormat::Png, help = "Output format of atlas")]
29    pub image: format::ImageFormat,
30
31    /// Dictionary format, if any
32    #[clap(
33        short,
34        long,
35        arg_enum,
36        value_parser,
37        help = "Output format of dictionary (optional)"
38    )]
39    pub dict: Option<format::DictionaryFormat>,
40
41    /// Name of output image and dictionary
42    #[clap(short, long, value_parser, default_value_t = String::from("atlas"), help = "Name of output file(s)")]
43    pub output: String,
44
45    /// Width of the output atlas
46    #[clap(
47        short,
48        long,
49        value_parser,
50        default_value_t = 1024,
51        help = "Width of output atlas"
52    )]
53    pub width: u32,
54
55    /// Height of the output atlas
56    #[clap(
57        short,
58        long,
59        value_parser,
60        default_value_t = 1024,
61        help = "Height of output atlas"
62    )]
63    pub height: u32,
64}