This commit is contained in:
naskya 2024-06-21 03:18:21 +09:00
parent 33592de8f3
commit fce417214d
Signed by: naskya
GPG key ID: 712D413B3A9FED5C
3 changed files with 6 additions and 4 deletions

View file

@ -446,7 +446,7 @@ pub(super) async fn run() -> Result<(), Error> {
.as_bytes(), .as_bytes(),
) )
.map_err(WriteTomlConfigError::ServerWrite)?; .map_err(WriteTomlConfigError::ServerWrite)?;
cprintln!("<g!><bold>config/server.toml</></> has been created!"); cprintln!("<bold>config/server.toml</> has been created!");
let mut client_toml = let mut client_toml =
fs::File::create("config/client.toml").map_err(WriteTomlConfigError::ClientWrite)?; fs::File::create("config/client.toml").map_err(WriteTomlConfigError::ClientWrite)?;
@ -457,7 +457,7 @@ pub(super) async fn run() -> Result<(), Error> {
.as_bytes(), .as_bytes(),
) )
.map_err(WriteTomlConfigError::ClientWrite)?; .map_err(WriteTomlConfigError::ClientWrite)?;
cprintln!("<g><bold>config/client.toml</></> has been created!"); cprintln!("<bold>config/client.toml</> has been created!");
Ok(()) Ok(())
} }

View file

@ -6,7 +6,7 @@
// does not take care of it. // does not take care of it.
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use validator::{Validate, ValidationErrors}; use validator::Validate;
#[derive(Deserialize, Serialize, Validate, Debug)] #[derive(Deserialize, Serialize, Validate, Debug)]
pub struct Config { pub struct Config {
@ -81,6 +81,7 @@ pub struct CacheServer {
pub port: u16, pub port: u16,
pub user: Option<String>, pub user: Option<String>,
pub password: Option<String>, pub password: Option<String>,
#[validate(range(min = 0, max = 15))]
pub index: Option<u8>, pub index: Option<u8>,
pub prefix: Option<String>, pub prefix: Option<String>,
} }

View file

@ -2,6 +2,7 @@ mod command;
mod config; mod config;
use clap::{Parser, Subcommand}; use clap::{Parser, Subcommand};
use color_print::cprintln;
/// latest Firefish version as of this fishctl release /// latest Firefish version as of this fishctl release
const FIREFISH_VERSION: &str = "20240613"; const FIREFISH_VERSION: &str = "20240613";
@ -37,7 +38,7 @@ async fn main() {
let res = run().await; let res = run().await;
if let Err(err) = res { if let Err(err) = res {
println!("An error occurred!"); cprintln!("<r!><bold>Error:</></>");
println!(" raw: {:?}", err); println!(" raw: {:?}", err);
println!(" message: {}", err); println!(" message: {}", err);