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, ValueEnum};
use std::path::PathBuf;
use crate::RootArgs;
#[derive(Debug, Clone, Parser)]
pub(crate) struct AddArgs {
#[command(flatten)]
pub(super) root: RootArgs,
/// Policy config path.
#[arg(long)]
pub(super) config: Option<PathBuf>,
/// Finding kind to add.
#[arg(long)]
pub(super) kind: String,
/// Path containing the finding.
#[arg(long)]
pub(super) path: PathBuf,
/// Line near the finding.
#[arg(long)]
pub(super) line: u32,
/// Owner for the retained exception.
#[arg(long)]
pub(super) owner: String,
/// Reason this exception is acceptable.
#[arg(long)]
pub(super) reason: String,
/// Classification for the retained exception.
#[arg(long, default_value = "reviewed_exception")]
pub(super) classification: String,
/// Review date for the retained exception. Defaults to roughly 90 days from today.
#[arg(long)]
pub(super) review_after: Option<String>,
/// Optional expiry date for the retained exception.
#[arg(long)]
pub(super) expires: Option<String>,
/// Evidence reference supporting this exception.
#[arg(long)]
pub(super) evidence: Vec<String>,
/// Entry ID. Defaults to the next allow-NNNN ID.
#[arg(long)]
pub(super) id: Option<String>,
/// Include untracked files in addition to git-tracked files.
#[arg(long)]
pub(super) include_untracked: bool,
/// Write proposed policy to this path.
#[arg(long)]
pub(super) write: Option<PathBuf>,
/// Overwrite an existing output policy file.
#[arg(long)]
pub(super) force: bool,
/// Summary output format. Policy output remains TOML.
#[arg(long, value_enum, default_value_t = AddSummaryFormat::Human)]
pub(super) summary_format: AddSummaryFormat,
/// Write add summary to a file instead of stderr.
#[arg(long)]
pub(super) summary_output: Option<PathBuf>,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, ValueEnum)]
pub(super) enum AddSummaryFormat {
Human,
Json,
}