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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//! `reconcile` subcommand: parse-shape.
//!
//! Holds the clap derive structs only. No I/O, no business logic.
use camino::Utf8PathBuf;
use clap::Subcommand;
/// Compute, read, and apply one plan.
#[derive(Debug, clap::Args)]
pub struct ReconcileArgs {
/// The verb to run.
#[command(subcommand)]
pub command: ReconcileCommand,
}
/// Every verb `sdd reconcile` offers.
#[derive(Debug, Subcommand)]
pub enum ReconcileCommand {
/// Compute one plan, store it, and print it.
Plan(PlanArgs),
/// Render one stored plan, or the latest result for its id.
Show(ShowArgs),
/// Execute one stored plan, or refuse because its inputs moved.
Apply(ApplyArgs),
}
/// Render one stored plan, or the latest result for its id.
#[derive(Debug, clap::Args)]
pub struct ShowArgs {
/// The plan's id, which is its fingerprint.
pub plan_id: String,
/// Print one JSON object instead of text.
#[arg(long)]
pub json: bool,
}
/// Execute one stored plan.
#[derive(Debug, clap::Args)]
pub struct ApplyArgs {
/// The plan's id, which is its fingerprint.
pub plan_id: String,
/// The repository to apply to; absolute, or the working directory.
#[arg(long, default_value = ".")]
pub target: Utf8PathBuf,
/// Print one JSON object instead of text.
#[arg(long)]
pub json: bool,
}
/// Compute one plan, store it, and print it.
#[derive(Debug, clap::Args)]
pub struct PlanArgs {
/// The repository to plan for; absolute, or the working directory.
#[arg(long, default_value = ".")]
pub target: Utf8PathBuf,
/// The destination release: `embedded`, `latest`, or a version.
///
/// The default is the release this binary carries, which keeps the
/// default offline.
#[arg(long, default_value = "embedded")]
pub to: String,
/// Forbid every network read.
#[arg(long)]
pub offline: bool,
/// Answer one decision the plan offers, as `<decision-id>=<answer>`.
///
/// Repeatable. Selecting a decision is what re-plans with it, so an
/// approval binds to the answers it was given with.
#[arg(long = "set", value_name = "DECISION=ANSWER")]
pub set: Vec<String>,
/// A path no delivered gate judges. Repeatable.
///
/// A region another tool renders or hashes. It changes what the
/// landing writes, so it is part of the plan rather than a flag on
/// the apply.
#[arg(long, value_name = "PATH")]
pub reserve: Vec<String>,
/// Print one JSON object instead of text.
#[arg(long)]
pub json: bool,
}