summaryrefslogtreecommitdiffstats
path: root/bin/domain/imag-mail/src/config.rs
diff options
context:
space:
mode:
Diffstat (limited to 'bin/domain/imag-mail/src/config.rs')
-rw-r--r--bin/domain/imag-mail/src/config.rs35
1 files changed, 32 insertions, 3 deletions
diff --git a/bin/domain/imag-mail/src/config.rs b/bin/domain/imag-mail/src/config.rs
index 0e43ac8e..a7a991d7 100644
--- a/bin/domain/imag-mail/src/config.rs
+++ b/bin/domain/imag-mail/src/config.rs
@@ -38,12 +38,25 @@ pub struct MailConfig {
import_tag: Option<String>,
#[serde(rename = "import_notmuch_tags")]
- import_notmuch_tags: bool
+ import_notmuch_tags: bool,
+
+ #[serde(rename = "edit_headers")]
+ edit_headers: bool,
+
+ #[serde(rename = "default_template")]
+ default_template: String,
+
+ #[serde(rename = "header_template")]
+ header_template: String,
+
+ #[serde(rename = "from_address")]
+ from_address: String,
+
}
impl MailConfig {
- pub fn get_list_format(&self, scmd: &ArgMatches) -> Result<Handlebars> {
+ pub fn get_list_format_or_cli(&self, scmd: &ArgMatches) -> Result<Handlebars> {
let fmt = scmd
.value_of("format")
.map(String::from)
@@ -58,7 +71,8 @@ impl MailConfig {
Ok(hb)
}
- pub fn get_notmuch_database_path(&self, rt: &Runtime) -> PathBuf {
+ /// Get the notmuch database path either from CLI or from config
+ pub fn get_notmuch_database_path_or_cli(&self, rt: &Runtime) -> PathBuf {
if let Some(pb) = rt.cli()
.value_of("database_path")
.map(String::from)
@@ -78,5 +92,20 @@ impl MailConfig {
self.import_notmuch_tags
}
+ pub fn get_edit_headers(&self) -> bool {
+ self.edit_headers
+ }
+
+ pub fn get_default_template(&self) -> &String {
+ &self.default_template
+ }
+
+ pub fn get_header_template(&self) -> &String {
+ &self.header_template
+ }
+
+ pub fn get_from_address(&self) -> &String {
+ &self.from_address
+ }
}