From b0ea87dbd629ac99f90c474da73fbc683ad66bbf Mon Sep 17 00:00:00 2001 From: Joscha Date: Tue, 29 Apr 2025 01:36:38 +0200 Subject: [PATCH] Rename migrate command to tidy It now does more than plain data dir migration. I'm not yet sure though when tidying will be executed during normal operations. During app startup sounds appropriate, maybe even at the end of open_and_migrate. --- gdn-cli/src/commands.rs | 6 +++--- gdn-cli/src/commands/{migrate.rs => tidy.rs} | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) rename gdn-cli/src/commands/{migrate.rs => tidy.rs} (58%) diff --git a/gdn-cli/src/commands.rs b/gdn-cli/src/commands.rs index 5b9b077..873bef0 100644 --- a/gdn-cli/src/commands.rs +++ b/gdn-cli/src/commands.rs @@ -2,20 +2,20 @@ use clap::Parser; use crate::Environment; -mod migrate; mod status; +mod tidy; #[derive(Debug, Parser)] pub enum Command { - Migrate(migrate::Command), Status(status::Command), + Tidy(tidy::Command), } impl Command { pub fn run(self, env: &Environment) -> anyhow::Result<()> { match self { - Self::Migrate(command) => command.run(env), Self::Status(command) => command.run(env), + Self::Tidy(command) => command.run(env), } } } diff --git a/gdn-cli/src/commands/migrate.rs b/gdn-cli/src/commands/tidy.rs similarity index 58% rename from gdn-cli/src/commands/migrate.rs rename to gdn-cli/src/commands/tidy.rs index b29d9c4..35b2289 100644 --- a/gdn-cli/src/commands/migrate.rs +++ b/gdn-cli/src/commands/tidy.rs @@ -2,13 +2,14 @@ use clap::Parser; use crate::Environment; -/// Create or migrate the data dir, if necessary. +/// Perform data dir maintenance. #[derive(Debug, Parser)] pub struct Command {} impl Command { pub fn run(self, env: &Environment) -> anyhow::Result<()> { - gdn::data::open_and_migrate(env.data_dir.clone())?; + let data = gdn::data::open_and_migrate(env.data_dir.clone())?; + gdn::data::tidy(&data)?; Ok(()) } }