dry4rust/cli/command.rs
1// Copyright (c) 2026 Matjaz Domen Pecan
2// Copyright 2026 Umberto Gotti <umberto.gotti@umbertogotti.dev>
3// Licensed under the MIT License
4// SPDX-License-Identifier: MIT
5
6/// CLI subcommands for `cargo-dry4rust`.
7#[derive(Debug, Clone, clap::Subcommand)]
8pub enum Command {
9 /// Show duplication statistics only.
10 Stats,
11 /// Show full duplication report (default).
12 Report,
13 /// Check for duplicates and exit with non-zero if thresholds exceeded.
14 Check {
15 /// Maximum allowed exact duplicate groups (exit 1 if exceeded).
16 #[arg(long)]
17 max_exact: Option<usize>,
18 /// Maximum allowed near duplicate groups (exit 1 if exceeded).
19 #[arg(long)]
20 max_near: Option<usize>,
21 /// Maximum allowed exact duplicate percentage (exit 1 if exceeded).
22 #[arg(long)]
23 max_exact_percent: Option<f64>,
24 /// Maximum allowed near duplicate percentage (exit 1 if exceeded).
25 #[arg(long)]
26 max_near_percent: Option<f64>,
27 },
28 /// Add a fingerprint to the ignore list.
29 Ignore {
30 /// The fingerprint to ignore (hex string).
31 fingerprint: String,
32 /// Reason for ignoring.
33 #[arg(long)]
34 reason: Option<String>,
35 },
36 /// List all ignored fingerprints.
37 Ignored,
38 /// Remove stale entries from the ignore file.
39 Cleanup {
40 /// Only list stale entries without removing them.
41 #[arg(long)]
42 dry_run: bool,
43 },
44 /// Record the duplication that is already there, so `check` fails on what
45 /// is added rather than on what was inherited.
46 Baseline {
47 /// Only list what would be recorded, without writing the file.
48 #[arg(long)]
49 dry_run: bool,
50 },
51}