Skip to content

Commit edbf30a

Browse files
committed
Merge remote-tracking branch 'origin/main' into deleted-crates-min-version
2 parents a1606a8 + 92b8fac commit edbf30a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/bin/crates-admin/delete_crate.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ pub struct Opts {
3838
/// An optional message explaining why the crate was deleted.
3939
#[arg(long)]
4040
message: Option<String>,
41+
42+
/// The amount of time (in hours) before making the crate available
43+
/// for re-registration.
44+
#[arg(long, default_value = "24")]
45+
availability_delay: i64,
4146
}
4247

4348
pub async fn run(opts: Opts) -> anyhow::Result<()> {
@@ -75,6 +80,7 @@ pub async fn run(opts: Opts) -> anyhow::Result<()> {
7580
}
7681

7782
let now = Utc::now();
83+
let available_at = now + chrono::TimeDelta::hours(opts.availability_delay);
7884

7985
for name in &crate_names {
8086
if let Some(crate_info) = existing_crates.iter().find(|info| info.name == *name) {
@@ -97,7 +103,7 @@ pub async fn run(opts: Opts) -> anyhow::Result<()> {
97103
.deleted_at(&now)
98104
.deleted_by(deleted_by.id)
99105
.maybe_message(opts.message.as_deref())
100-
.available_at(&now)
106+
.available_at(&available_at)
101107
.maybe_min_version(min_version.as_deref())
102108
.build();
103109

0 commit comments

Comments
 (0)