aboutsummaryrefslogtreecommitdiff
path: root/src/config.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.rs')
-rw-r--r--src/config.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/config.rs b/src/config.rs
index 2ef296a..a80cc13 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -30,16 +30,25 @@ pub struct BibiConfig {
#[derive(Debug, Clone, Deserialize)]
pub struct General {
pub bibfiles: Vec<PathBuf>,
- pub editor: String,
+ pub editor: Option<String>,
}
impl BibiConfig {
- pub fn new(args: &mut CLIArgs) -> Result<Self, ConfigError> {
+ pub fn default(args: &CLIArgs) -> Self {
+ Self {
+ general: General {
+ bibfiles: args.pos_args.clone(),
+ editor: None,
+ },
+ }
+ }
+
+ pub fn new(args: &CLIArgs) -> Result<Self, ConfigError> {
let mut cfg = config::Config::builder();
cfg = cfg.add_source(
config::File::from(args.cfg_path.clone())
.format(FileFormat::Toml)
- .required(true),
+ .required(false),
);
cfg.build()?.try_deserialize()
}