diff --git a/src/command/config/migrate/v20240701.rs b/src/command/config/migrate/v20240701.rs index cb1b2ae..e536051 100644 --- a/src/command/config/migrate/v20240701.rs +++ b/src/command/config/migrate/v20240701.rs @@ -446,7 +446,7 @@ pub(super) async fn run() -> Result<(), Error> { .as_bytes(), ) .map_err(WriteTomlConfigError::ServerWrite)?; - cprintln!("config/server.toml has been created!"); + cprintln!("config/server.toml has been created!"); let mut client_toml = fs::File::create("config/client.toml").map_err(WriteTomlConfigError::ClientWrite)?; @@ -457,7 +457,7 @@ pub(super) async fn run() -> Result<(), Error> { .as_bytes(), ) .map_err(WriteTomlConfigError::ClientWrite)?; - cprintln!("config/client.toml has been created!"); + cprintln!("config/client.toml has been created!"); Ok(()) } diff --git a/src/config/server.rs b/src/config/server.rs index c0cc8f5..f6f1eca 100644 --- a/src/config/server.rs +++ b/src/config/server.rs @@ -6,7 +6,7 @@ // does not take care of it. use serde::{Deserialize, Serialize}; -use validator::{Validate, ValidationErrors}; +use validator::Validate; #[derive(Deserialize, Serialize, Validate, Debug)] pub struct Config { @@ -81,6 +81,7 @@ pub struct CacheServer { pub port: u16, pub user: Option, pub password: Option, + #[validate(range(min = 0, max = 15))] pub index: Option, pub prefix: Option, } diff --git a/src/main.rs b/src/main.rs index 150a143..b7979ee 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,6 +2,7 @@ mod command; mod config; use clap::{Parser, Subcommand}; +use color_print::cprintln; /// latest Firefish version as of this fishctl release const FIREFISH_VERSION: &str = "20240613"; @@ -37,7 +38,7 @@ async fn main() { let res = run().await; if let Err(err) = res { - println!("An error occurred!"); + cprintln!("Error:"); println!(" raw: {:?}", err); println!(" message: {}", err);