1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
use clap::Parser;
use std::path::PathBuf;

use crate::format;

/// A `clap` parser structure
#[derive(Debug, Parser)]
#[clap(
    about = "Yet Another Texture Packer - a small and simple CLI application to pack \nmultiple textures/sprites into a texture atlas/sprite sheet."
)]
#[clap(version = env!("CARGO_PKG_VERSION"))]
pub struct Cli {
    /// Input images and folders
    #[clap(value_parser, help = "Files and folders to pack")]
    pub inputs: Vec<PathBuf>,

    /// Gap between packed textures
    #[clap(
        short,
        long,
        value_parser,
        default_value_t = 0,
        help = "Gap between packed textures"
    )]
    pub gap: u32,

    /// Image format
    #[clap(short, long, arg_enum, value_parser, default_value_t = format::ImageFormat::Png, help = "Output format of atlas")]
    pub image: format::ImageFormat,

    /// Dictionary format, if any
    #[clap(
        short,
        long,
        arg_enum,
        value_parser,
        help = "Output format of dictionary (optional)"
    )]
    pub dict: Option<format::DictionaryFormat>,

    /// Name of output image and dictionary
    #[clap(short, long, value_parser, default_value_t = String::from("atlas"), help = "Name of output file(s)")]
    pub output: String,

    /// Width of the output atlas
    #[clap(
        short,
        long,
        value_parser,
        default_value_t = 1024,
        help = "Width of output atlas"
    )]
    pub width: u32,

    /// Height of the output atlas
    #[clap(
        short,
        long,
        value_parser,
        default_value_t = 1024,
        help = "Height of output atlas"
    )]
    pub height: u32,
}