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
90
91
92
93
//! `stage` subcommand: parse-shape.
//!
//! Holds the clap derive structs only. No I/O, no business logic.
use camino::Utf8PathBuf;
use crate::domain::profile::ProfileId;
/// Render this binary's candidate into a stage an agent reads.
#[derive(Debug, clap::Args)]
pub struct StageArgs {
/// What to do. Rendering a stage is the default.
#[command(subcommand)]
pub command: Option<StageCommand>,
/// The repository to render a candidate for; absolute, or the working directory.
#[arg(long, default_value = ".")]
pub target: Utf8PathBuf,
/// The profile to project: the recorded one where an instance exists,
/// which a different value refuses; codebase where nothing is recorded.
#[arg(long, value_enum)]
pub profile: Option<ProfileId>,
/// Where to write the stage; absolute.
#[arg(long)]
pub output: Option<Utf8PathBuf>,
/// The documentation scratch the candidate would record, or `none`.
#[arg(long)]
pub docs_scratch: Option<String>,
/// A path to record under `reserved:` in the declaration. Repeatable.
#[arg(long)]
pub reserve: Vec<String>,
/// The writing-style selection the candidate would record, unless the
/// declaration already holds it; a missing key holds `builtin`.
#[arg(long)]
pub writing_style: Option<String>,
/// Record that every host installs sdd itself, at this release or newer,
/// where no manager file pins it.
#[arg(long, value_enum)]
pub acquisition: Option<AcquisitionChoice>,
/// Print one JSON object instead of text.
#[arg(long)]
pub json: bool,
}
/// How the project obtains `sdd`, where no manager file records it.
#[derive(Debug, Clone, Copy, PartialEq, Eq, clap::ValueEnum)]
pub enum AcquisitionChoice {
/// Each host installs `sdd` itself.
Host,
}
/// The verbs `sdd stage` offers beyond rendering one.
#[derive(Debug, clap::Subcommand)]
pub enum StageCommand {
/// Remove one stage this tool wrote.
Clean(StageCleanArgs),
/// Compare one stage against its target, one row per destination.
Compare(StageCompareArgs),
}
/// Compare one stage against the target it was rendered for.
#[derive(Debug, clap::Args)]
pub struct StageCompareArgs {
/// The stage directory to read; absolute.
pub root: Utf8PathBuf,
/// The repository the stage was rendered for; absolute, or the working
/// directory.
#[arg(long, default_value = ".")]
pub target: Utf8PathBuf,
/// Print one JSON object instead of text.
#[arg(long)]
pub json: bool,
}
/// Remove one stage this tool wrote.
#[derive(Debug, clap::Args)]
pub struct StageCleanArgs {
/// The stage directory to remove; absolute.
pub path: Utf8PathBuf,
/// Print one JSON object instead of text.
#[arg(long)]
pub json: bool,
}