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
use clap::{Parser, ValueEnum};
use std::path::PathBuf;
use crate::RootArgs;
#[derive(Debug, Clone, Parser)]
pub(crate) struct MigrateArgs {
#[command(flatten)]
pub(super) root: RootArgs,
/// Legacy or canonical policy file to migrate.
#[arg(long)]
pub(super) from: Option<PathBuf>,
/// Directory containing compatible legacy policy files.
#[arg(long)]
pub(super) repo_policy: Option<PathBuf>,
/// Output canonical policy path.
#[arg(long, default_value = "policy/allow.toml")]
pub(super) out: PathBuf,
/// Overwrite an existing output policy file.
#[arg(long)]
pub(super) force: bool,
/// Update the output policy in place via atomic replace instead of
/// requiring --force when the target already exists. The output is
/// validated before writing and unrelated entries are preserved.
/// Mutually exclusive with --force.
#[arg(long)]
pub(super) update: bool,
/// Summary output format. Policy output remains TOML.
#[arg(long, value_enum, default_value_t = MigrateSummaryFormat::Human)]
pub(super) summary_format: MigrateSummaryFormat,
/// Write migration 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 MigrateSummaryFormat {
Human,
Json,
}