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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
//! Arguments for `rk migrate`.
use camino::Utf8PathBuf;
use clap::{Args, Subcommand};
/// Carry a target off another release tool through an archive and a
/// greenfield landing.
#[derive(Debug, Args)]
pub struct MigrateArgs {
/// What to do with the migration.
#[command(subcommand)]
pub action: MigrateAction,
}
/// The migration verbs. The archive opens a migration, the marks record
/// the map and the loop, and the close ends it; the workspace under the
/// state root keeps the archive and the registry between runs.
#[derive(Debug, Subcommand)]
pub enum MigrateAction {
/// List every predecessor file with its tool and its kind, and the
/// root files that stay in place; read-only.
Inventory {
/// The repository to read.
#[arg(long, default_value = ".")]
target: Utf8PathBuf,
/// Emit one JSON object on stdout instead of the human report.
#[arg(long)]
json: bool,
},
/// Move every predecessor file into a new workspace, snapshot what no
/// Git holds, and open the migration; preview by default. On an open
/// migration it takes the forge snapshots still missing.
Archive {
/// The repository to act on.
#[arg(long, default_value = ".")]
target: Utf8PathBuf,
/// Move the files and write the workspace; without it the archive
/// is reported and nothing is touched.
#[arg(long)]
apply: bool,
/// Recreate the archived files of the open migration from Git at
/// its base commit, on a clone whose workspace is gone; preview by
/// default, written with `--apply`. It writes the workspace alone,
/// never the target.
#[arg(long)]
rebuild: bool,
/// Emit one JSON object on stdout instead of the human report.
#[arg(long)]
json: bool,
},
/// Record a status for a source or a group, appending a dated history
/// entry; `--group` files a source, `--destination` names where a
/// group's kept content lives, and a drop names its reason.
Mark {
/// A source, by id or path, or a group, by id.
name: String,
/// pending, mapped, written, verified, or dropped.
status: String,
/// The group a source joins, created where it is new.
#[arg(long)]
group: Option<String>,
/// A topic label for a source; repeatable.
#[arg(long = "tag")]
tags: Vec<String>,
/// A destination a group's kept content lives at; repeatable.
#[arg(long = "destination")]
destinations: Vec<String>,
/// Why a source or a group is dropped.
#[arg(long)]
reason: Option<String>,
/// The repository whose migration to mark.
#[arg(long, default_value = ".")]
target: Utf8PathBuf,
/// Emit one JSON object on stdout instead of the human report.
#[arg(long)]
json: bool,
},
/// Report the open migration: each source's status and checksum, the
/// groups, the snapshots, and what still blocks the close; read-only.
Status {
/// The repository to read.
#[arg(long, default_value = ".")]
target: Utf8PathBuf,
/// Emit one JSON object on stdout instead of the human report.
#[arg(long)]
json: bool,
},
/// End the migration once every source is verified or dropped and the
/// setup proof is current, removing the configuration key; preview by
/// default. The workspace stays for the operator.
Close {
/// The repository to act on.
#[arg(long, default_value = ".")]
target: Utf8PathBuf,
/// Remove the key; without it the close is judged and nothing is
/// touched.
#[arg(long)]
apply: bool,
/// Emit one JSON object on stdout instead of the human report.
#[arg(long)]
json: bool,
},
}