1use serde::{Deserialize, Serialize};
2
3#[derive(Serialize, Deserialize)]
4pub struct Options {
5 name_template: String,
6 editor: String,
7}
8#[derive(Serialize, Deserialize)]
9pub struct Config {
10 options: Options,
11}
12
13impl Default for Config {
14 fn default() -> Self {
15 Config {
16 options: Options {
17 name_template: String::from("Note&i"),
18 editor: String::from("nano"),
19 },
20 }
21 }
22}
23
24impl Config {
25 pub fn get_template(&self) -> String {
26 self.options.name_template.clone()
27 }
28
29 pub fn set_template(&mut self, new_template: &str) {
30 self.options.name_template = String::from(new_template);
31 }
32
33 pub fn get_editor(&self) -> String {
34 self.options.editor.clone()
35 }
36
37 pub fn set_editor(&mut self, editor: &str) {
38 self.options.editor = String::from(editor);
39 }
40}