aboutsummaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
authorlukeflo2025-10-08 13:49:06 +0200
committerlukeflo2025-10-08 13:49:06 +0200
commita07359a9a1da0c06c040f77158be31b3883b33ac (patch)
tree78317d775f5d62d7e48663bdb75794aae17b5ea4 /src/config.rs
parent67afd67d4d51a00079269d431a7058fc50750886 (diff)
downloadbibiman-a07359a9a1da0c06c040f77158be31b3883b33ac.tar.gz
bibiman-a07359a9a1da0c06c040f77158be31b3883b33ac.zip
refine matching and preformatting of fields for citekey formattin; add case field and enum
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/config.rs b/src/config.rs
index 78cfef9..8a333e4 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -16,21 +16,24 @@
/////
use std::{
- fs::{create_dir_all, File},
- io::{stdin, Write},
+ fs::{File, create_dir_all},
+ io::{Write, stdin},
path::PathBuf,
str::FromStr,
};
use color_eyre::{eyre::Result, owo_colors::OwoColorize};
use figment::{
- providers::{Format, Serialized, Toml},
Figment,
+ providers::{Format, Serialized, Toml},
};
use ratatui::style::Color;
use serde::{Deserialize, Serialize};
-use crate::{bibiman::bibisetup::CustomField, cliargs::CLIArgs};
+use crate::{
+ bibiman::{bibisetup::CustomField, citekeys::CitekeyCase},
+ cliargs::CLIArgs,
+};
const DEFAULT_CONFIG: &str = r##"
# [general]
@@ -147,6 +150,7 @@ pub struct Colors {
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct CitekeyFormatter {
pub fields: Vec<String>,
+ pub case: Option<CitekeyCase>,
}
impl Default for BibiConfig {
@@ -167,7 +171,10 @@ impl Default for BibiConfig {
custom_column: CustomField::Pubtype,
},
colors: Self::dark_colors(),
- citekey_formatter: CitekeyFormatter { fields: Vec::new() },
+ citekey_formatter: CitekeyFormatter {
+ fields: Vec::new(),
+ case: None,
+ },
}
}
}
@@ -194,7 +201,10 @@ impl BibiConfig {
} else {
Self::dark_colors()
},
- citekey_formatter: CitekeyFormatter { fields: Vec::new() },
+ citekey_formatter: CitekeyFormatter {
+ fields: Vec::new(),
+ case: None,
+ },
}
}
@@ -352,8 +362,8 @@ fn select_opener() -> String {
#[cfg(test)]
mod tests {
use figment::{
- providers::{Format, Toml},
Figment,
+ providers::{Format, Toml},
};
use super::BibiConfig;