diff --git a/src/user_preferences/mod.rs b/src/user_preferences/mod.rs index d5dfc97..0870554 100644 --- a/src/user_preferences/mod.rs +++ b/src/user_preferences/mod.rs @@ -14,7 +14,7 @@ use crate::user_preferences::v0::UserPreferencesV0; use crate::{InstanceSettings, Pronoun, WeightedTable}; use data_encoding::BASE32_NOPAD; -use serde; +use serde::{Serialize, Deserialize}; /// A user's preferences for the probabilities of certain pronouns /// @@ -28,7 +28,7 @@ use serde; /// Because parsing a prefstring must be done in relation to an [`InstanceSettings`], the /// `UserPreferences` struct shares a lifetime with the settings it was created with. #[non_exhaustive] -#[derive(Clone, Debug, PartialEq, Eq, serde::Serialize, serde::Deserialize)] +#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] #[serde(try_from = "Intermediary", into = "Intermediary")] pub enum UserPreferences { V0(v0::UserPreferencesV0) diff --git a/web/src/configuration.rs b/web/src/configuration.rs index b301a0a..f06d6dd 100644 --- a/web/src/configuration.rs +++ b/web/src/configuration.rs @@ -1,3 +1,4 @@ +use std::path::PathBuf; use pronouns_today::PronounList; use pronouns_today::UserPreferences; use std::fs::OpenOptions; @@ -45,16 +46,16 @@ pub struct Run { #[cfg_attr(feature = "docker", argh( option, - default = "String::from(\"/data/config.yml\")", + default = "PathBuf::from(\"/data/config.yml\")", short = 'c'))] #[cfg_attr(not(feature = "docker"), argh( option, - default = "String::from(\"/etc/pronouns_today.yml\")", + default = "PathBuf::from(\"/etc/pronouns_today.yml\")", short = 'c'))] /// path to the config file (generated if needed). Defaults to /// /etc/pronouns_today.yml - pub config: String, + pub config: PathBuf, #[argh(switch)] /// don't attempt to read or generate a config file, just use command line args. Missing @@ -152,6 +153,6 @@ pub enum ConfigError { /// The config file was missing, but has been created /// /// The program should now prompt the user to fill the config in, and then exit. The - /// provided [`String`] contains the path to the new config file - ConfigCreated(String), + /// provided [`PathBuf`] contains the path to the new config file + ConfigCreated(PathBuf), } diff --git a/web/src/main.rs b/web/src/main.rs index cd7b16f..3f2c5b9 100644 --- a/web/src/main.rs +++ b/web/src/main.rs @@ -166,8 +166,8 @@ async fn main() -> std::io::Result<()> { Err(ConfigError::ConfigCreated(path)) => { println!("A config file has been generated at {}! Please check it out and modify it to your liking, and then run this command - again", path); - exit(0); + again", path.display()); + exit(1002); } }; log::info!("Starting with configuration {:?}", config);