migrate -> update
This commit is contained in:
parent
40358b5d4d
commit
055ee2ca64
5 changed files with 14 additions and 14 deletions
|
@ -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
|
||||
|
|
|
@ -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<Revision> },
|
||||
/// Convert old config files to the new format
|
||||
Update { revision: Option<Revision> },
|
||||
/// 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<Option<Revision>, 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()?,
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Revision>) -> Result<(), MigrationError> {
|
||||
pub(super) async fn run(revision: Option<Revision>) -> Result<(), UpdateError> {
|
||||
match revision {
|
||||
Some(revision) => run_impl(revision).await,
|
||||
None => update_to_latest().await,
|
|
@ -1,4 +1,4 @@
|
|||
//! `config migrate 20240701` subcommand
|
||||
//! `config update 20240701` subcommand
|
||||
//! <https://firefish.dev/firefish/firefish/-/issues/10947>
|
||||
|
||||
use crate::config::{
|
|
@ -31,7 +31,7 @@ enum ReadError {
|
|||
pub(super) fn run() -> Result<(), ValidationError> {
|
||||
if next_revision()?.is_some() {
|
||||
cprintln!(
|
||||
"Please first run `<bold>fishctl config migrate</>` to update your config files."
|
||||
"Please first run `<bold>fishctl config update</>` to update your config files."
|
||||
);
|
||||
return Err(ValidationError::OutOfDate);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue