Extract euph config into submodule
This commit is contained in:
parent
478e3e767c
commit
5a0efd69e4
3 changed files with 62 additions and 52 deletions
|
|
@ -10,64 +10,15 @@
|
|||
#![warn(clippy::use_self)]
|
||||
|
||||
pub mod doc;
|
||||
mod euph;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::fs;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
use cove_macro::Document;
|
||||
use doc::{Doc, Document};
|
||||
use doc::Document;
|
||||
use serde::Deserialize;
|
||||
|
||||
#[derive(Debug, Clone, Copy, Default, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum RoomsSortOrder {
|
||||
#[default]
|
||||
Alphabet,
|
||||
Importance,
|
||||
}
|
||||
|
||||
impl Document for RoomsSortOrder {
|
||||
fn doc() -> Doc {
|
||||
let mut doc = String::doc();
|
||||
doc.value_info.values = Some(vec![
|
||||
// TODO Generate by serializing
|
||||
"`alphabet`".to_string(),
|
||||
"`importance`".to_string(),
|
||||
]);
|
||||
doc
|
||||
}
|
||||
}
|
||||
|
||||
// TODO Mark favourite rooms via printable ascii characters
|
||||
#[derive(Debug, Clone, Default, Deserialize, Document)]
|
||||
pub struct EuphRoom {
|
||||
/// Whether to automatically join this room on startup.
|
||||
#[serde(default)]
|
||||
#[document(default = "`false`")]
|
||||
pub autojoin: bool,
|
||||
|
||||
/// If set, cove will set this username upon joining if there is no username
|
||||
/// associated with the current session.
|
||||
pub username: Option<String>,
|
||||
|
||||
/// If `euph.rooms.<room>.username` is set, this will force cove to set the
|
||||
/// username even if there is already a different username associated with
|
||||
/// the current session.
|
||||
#[serde(default)]
|
||||
#[document(default = "`false`")]
|
||||
pub force_username: bool,
|
||||
|
||||
/// If set, cove will try once to use this password to authenticate, should
|
||||
/// the room be password-protected.
|
||||
pub password: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Default, Deserialize, Document)]
|
||||
pub struct Euph {
|
||||
#[document(metavar = "room")]
|
||||
pub rooms: HashMap<String, EuphRoom>,
|
||||
}
|
||||
pub use crate::euph::*;
|
||||
|
||||
#[derive(Debug, Default, Deserialize, Document)]
|
||||
pub struct Config {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue