diff --git a/README.md b/README.md index 2920450..22cc6db 100644 --- a/README.md +++ b/README.md @@ -62,12 +62,12 @@ If you want to use this in the host network, you should use `host` as the networ Please make sure to `cd` to the Firefish local repository before running these commands. -### Migrate the config files +### Update the config files [The admin note](https://firefish.dev/firefish/firefish/-/blob/main/docs/notice-for-admins.md) may tell you that you need to update the config files. In such a case, please execute the following command. ```sh -fishctl config migrate +fishctl config update ``` ### Validate the config files diff --git a/src/command/config.rs b/src/command/config.rs index 7ff7620..d2c45fe 100644 --- a/src/command/config.rs +++ b/src/command/config.rs @@ -1,6 +1,6 @@ //! `config` subcommand -mod migrate; +mod update; mod validate; use crate::config::{Revision, CLIENT_CONFIG_PATH, OLD_CONFIG_PATH, SERVER_CONFIG_PATH}; @@ -10,8 +10,8 @@ use std::{fs, io::Read, path::Path}; #[derive(Subcommand)] pub(crate) enum Commands { - /// Convert an old config file into the new format - Migrate { revision: Option }, + /// Convert old config files to the new format + Update { revision: Option }, /// Validate the config file Validate, } @@ -19,7 +19,7 @@ pub(crate) enum Commands { #[derive(thiserror::Error, Debug)] pub(crate) enum Error { #[error(transparent)] - Migrate(#[from] migrate::MigrationError), + Update(#[from] update::UpdateError), #[error(transparent)] Validate(#[from] validate::ValidationError), } @@ -91,7 +91,7 @@ fn next_revision() -> Result, RevisionCheckError> { pub(crate) async fn run(command: Commands) -> Result<(), Error> { match command { - Commands::Migrate { revision } => migrate::run(revision).await?, + Commands::Update { revision } => update::run(revision).await?, Commands::Validate => validate::run()?, } diff --git a/src/command/config/migrate.rs b/src/command/config/update.rs similarity index 79% rename from src/command/config/migrate.rs rename to src/command/config/update.rs index 252a3f5..63d2e2e 100644 --- a/src/command/config/migrate.rs +++ b/src/command/config/update.rs @@ -1,4 +1,4 @@ -//! `config migrate` subcommand +//! `config update` subcommand mod v20240701; @@ -8,14 +8,14 @@ use crate::{ }; #[derive(thiserror::Error, Debug)] -pub(crate) enum MigrationError { +pub(crate) enum UpdateError { #[error(transparent)] UnknownRevision(#[from] RevisionCheckError), #[error(transparent)] V20240701(#[from] v20240701::Error), } -async fn update_to_latest() -> Result<(), MigrationError> { +async fn update_to_latest() -> Result<(), UpdateError> { if next_revision()?.is_none() { println!("Your config files are already up-to-date! (as of this fishctl release)"); return Ok(()); @@ -27,14 +27,14 @@ async fn update_to_latest() -> Result<(), MigrationError> { Ok(()) } -async fn run_impl(revision: Revision) -> Result<(), MigrationError> { +async fn run_impl(revision: Revision) -> Result<(), UpdateError> { match revision { Revision::V20240701 => v20240701::run().await?, } Ok(()) } -pub(super) async fn run(revision: Option) -> Result<(), MigrationError> { +pub(super) async fn run(revision: Option) -> Result<(), UpdateError> { match revision { Some(revision) => run_impl(revision).await, None => update_to_latest().await, diff --git a/src/command/config/migrate/v20240701.rs b/src/command/config/update/v20240701.rs similarity index 99% rename from src/command/config/migrate/v20240701.rs rename to src/command/config/update/v20240701.rs index aa7c330..8e6f87e 100644 --- a/src/command/config/migrate/v20240701.rs +++ b/src/command/config/update/v20240701.rs @@ -1,4 +1,4 @@ -//! `config migrate 20240701` subcommand +//! `config update 20240701` subcommand //! use crate::config::{ diff --git a/src/command/config/validate.rs b/src/command/config/validate.rs index 97ef002..4b74972 100644 --- a/src/command/config/validate.rs +++ b/src/command/config/validate.rs @@ -31,7 +31,7 @@ enum ReadError { pub(super) fn run() -> Result<(), ValidationError> { if next_revision()?.is_some() { cprintln!( - "Please first run `fishctl config migrate` to update your config files." + "Please first run `fishctl config update` to update your config files." ); return Err(ValidationError::OutOfDate); }