mirror of
https://github.com/soywod/himalaya.git
synced 2024-07-05 17:15:12 +00:00
remove config from domain module
This commit is contained in:
parent
54493540b4
commit
94f7dd5b05
10
src/config/arg.rs
Normal file
10
src/config/arg.rs
Normal file
|
@ -0,0 +1,10 @@
|
|||
use clap::Arg;
|
||||
|
||||
/// Config argument.
|
||||
pub fn path_arg<'a>() -> Arg<'a, 'a> {
|
||||
Arg::with_name("config")
|
||||
.long("config")
|
||||
.short("c")
|
||||
.help("Forces a specific config path")
|
||||
.value_name("PATH")
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
use clap::Arg;
|
||||
|
||||
pub fn config_args<'a>() -> Vec<Arg<'a, 'a>> {
|
||||
vec![
|
||||
Arg::with_name("config")
|
||||
.long("config")
|
||||
.short("c")
|
||||
.help("Forces a specific config path")
|
||||
.value_name("PATH"),
|
||||
Arg::with_name("account")
|
||||
.long("account")
|
||||
.short("a")
|
||||
.help("Selects a specific account")
|
||||
.value_name("NAME"),
|
||||
]
|
||||
}
|
|
@ -1 +1,4 @@
|
|||
pub mod cli;
|
||||
//! Modules related to the user's configuration.
|
||||
|
||||
pub mod arg;
|
||||
pub mod entity;
|
||||
|
|
10
src/domain/account/arg.rs
Normal file
10
src/domain/account/arg.rs
Normal file
|
@ -0,0 +1,10 @@
|
|||
use clap::Arg;
|
||||
|
||||
/// Account argument.
|
||||
pub fn name_arg<'a>() -> Arg<'a, 'a> {
|
||||
Arg::with_name("account")
|
||||
.long("account")
|
||||
.short("a")
|
||||
.help("Selects a specific account")
|
||||
.value_name("NAME")
|
||||
}
|
|
@ -3,7 +3,7 @@ use lettre::transport::smtp::authentication::Credentials as SmtpCredentials;
|
|||
use log::{debug, trace};
|
||||
use std::{convert::TryFrom, env, fs, path::PathBuf};
|
||||
|
||||
use crate::{domain::config::entity::Config, output::utils::run_cmd};
|
||||
use crate::{config::entity::Config, output::utils::run_cmd};
|
||||
|
||||
const DEFAULT_PAGE_SIZE: usize = 10;
|
||||
const DEFAULT_SIG_DELIM: &str = "-- \n";
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
//! Modules related to the user's accounts.
|
||||
|
||||
pub mod arg;
|
||||
pub mod entity;
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
//! Modules related to the user's configuration.
|
||||
|
||||
pub mod entity;
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use anyhow::Result;
|
||||
|
||||
use crate::domain::{config::entity::Config, imap::service::ImapServiceInterface};
|
||||
use crate::{config::entity::Config, domain::imap::service::ImapServiceInterface};
|
||||
|
||||
/// Notify handler.
|
||||
pub fn notify<ImapService: ImapServiceInterface>(
|
||||
|
|
|
@ -8,11 +8,13 @@ use log::{debug, trace};
|
|||
use native_tls::{self, TlsConnector, TlsStream};
|
||||
use std::{collections::HashSet, convert::TryFrom, iter::FromIterator, net::TcpStream};
|
||||
|
||||
use crate::domain::{
|
||||
account::entity::Account,
|
||||
use crate::{
|
||||
config::entity::Config,
|
||||
mbox::entity::Mbox,
|
||||
msg::{entity::Msg, flag::entity::Flags},
|
||||
domain::{
|
||||
account::entity::Account,
|
||||
mbox::entity::Mbox,
|
||||
msg::{entity::Msg, flag::entity::Flags},
|
||||
},
|
||||
};
|
||||
|
||||
type ImapSession = imap::Session<TlsStream<TcpStream>>;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
//! Domain-specific modules.
|
||||
|
||||
pub mod account;
|
||||
pub mod config;
|
||||
pub mod imap;
|
||||
pub mod mbox;
|
||||
pub mod msg;
|
||||
|
|
|
@ -6,10 +6,9 @@ use url::Url;
|
|||
|
||||
use himalaya::{
|
||||
compl,
|
||||
config::cli::config_args,
|
||||
config::{self, entity::Config},
|
||||
domain::{
|
||||
account::entity::Account,
|
||||
config::entity::Config,
|
||||
account::{self, entity::Account},
|
||||
imap::{self, service::ImapService},
|
||||
mbox::{self, entity::Mbox},
|
||||
msg,
|
||||
|
@ -24,7 +23,8 @@ fn create_app<'a>() -> clap::App<'a, 'a> {
|
|||
.about(env!("CARGO_PKG_DESCRIPTION"))
|
||||
.author(env!("CARGO_PKG_AUTHORS"))
|
||||
.args(&output_args())
|
||||
.args(&config_args())
|
||||
.arg(config::arg::path_arg())
|
||||
.arg(account::arg::name_arg())
|
||||
.arg(mbox::arg::source_arg())
|
||||
.subcommands(compl::arg::subcmds())
|
||||
.subcommands(imap::arg::subcmds())
|
||||
|
|
Loading…
Reference in a new issue