File: cli.rs

package info (click to toggle)
rust-deltae 0.3.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 184 kB
  • sloc: makefile: 2
file content (33 lines) | stat: -rw-r--r-- 1,074 bytes parent folder | download
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
use clap::{Command, Arg, ArgAction};
use deltae::DEMethod;
use std::str::FromStr;

pub fn command() -> Command {
    Command::new("deltae")
        .version(env!("CARGO_PKG_VERSION"))
        .about(env!("CARGO_PKG_DESCRIPTION"))
        .author(env!("CARGO_PKG_AUTHORS"))
        .arg(Arg::new("METHOD")
            .help("Set DeltaE method")
            .long("method")
            .short('m')
            .value_parser(DEMethod::from_str)
            .ignore_case(true)
            .default_value("2000")
            .action(ArgAction::Set))
        .arg(Arg::new("REFERENCE")
            .help("Reference color values")
            .required(true))
        .arg(Arg::new("SAMPLE")
            .help("Sample color values")
            .required(true))
        .arg(Arg::new("COLORTYPE")
            .help("Set color type")
            .short('c')
            .long("color-type")
            .aliases(["color", "type"])
            .default_value("lab")
            .value_names(["lab", "lch", "xyz"])
            .ignore_case(true)
            .action(ArgAction::Set))
}