prepare v0.8.0

This commit is contained in:
Clément DOUIN
2023-05-31 16:12:18 +02:00
parent 32b31db175
commit d557d9e1df
7 changed files with 68 additions and 121 deletions
+1 -1
View File
@@ -27,7 +27,7 @@ pub struct PipelineDef(
#[serde(getter = "Deref::deref", serialize_with = "pipeline")] Vec<SingleCmd>,
);
// NOTE: did not find the way to only do with macros…
// NOTE: did not find the way to do it with macros…
pub fn pipeline<S>(cmds: &Vec<SingleCmd>, s: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
+2 -20
View File
@@ -18,7 +18,6 @@ const ARG_PAGE_SIZE: &str = "page-size";
const ARG_QUERY: &str = "query";
const ARG_RAW: &str = "raw";
const ARG_REPLY_ALL: &str = "reply-all";
const ARG_SANITIZE: &str = "sanitize";
const CMD_ATTACHMENTS: &str = "attachments";
const CMD_COPY: &str = "copy";
const CMD_DELETE: &str = "delete";
@@ -44,7 +43,6 @@ pub type PageSize = usize;
pub type Query = String;
pub type Raw = bool;
pub type RawEmail = String;
pub type Sanitize = bool;
pub type TextMime<'a> = &'a str;
/// Represents the email commands.
@@ -57,7 +55,7 @@ pub enum Cmd<'a> {
Forward(Id<'a>, tpl::args::Headers<'a>, tpl::args::Body<'a>),
List(table::args::MaxTableWidth, Option<PageSize>, Page),
Move(Ids<'a>, Folder<'a>),
Read(Ids<'a>, TextMime<'a>, Sanitize, Raw, Headers<'a>),
Read(Ids<'a>, TextMime<'a>, Raw, Headers<'a>),
Reply(Id<'a>, All, tpl::args::Headers<'a>, tpl::args::Body<'a>),
Save(RawEmail),
Search(Query, table::args::MaxTableWidth, Option<PageSize>, Page),
@@ -104,10 +102,9 @@ pub fn matches<'a>(m: &'a ArgMatches) -> Result<Option<Cmd<'a>>> {
} else if let Some(m) = m.subcommand_matches(CMD_READ) {
let ids = parse_ids_arg(m);
let mime = parse_mime_type_arg(m);
let sanitize = parse_sanitize_flag(m);
let raw = parse_raw_flag(m);
let headers = parse_headers_arg(m);
Cmd::Read(ids, mime, sanitize, raw, headers)
Cmd::Read(ids, mime, raw, headers)
} else if let Some(m) = m.subcommand_matches(CMD_REPLY) {
let id = parse_id_arg(m);
let all = parse_reply_all_flag(m);
@@ -188,7 +185,6 @@ pub fn subcmds() -> Vec<Command> {
Command::new(CMD_READ)
.about("Read text bodies of emails")
.arg(mime_type_arg())
.arg(sanitize_flag())
.arg(raw_flag())
.arg(headers_arg())
.arg(ids_arg()),
@@ -364,15 +360,6 @@ pub fn parse_headers_arg(m: &ArgMatches) -> Vec<&str> {
.collect::<Vec<_>>()
}
/// Represents the sanitize flag.
pub fn sanitize_flag() -> Arg {
Arg::new(ARG_SANITIZE)
.help("Sanitizes text bodies")
.long("sanitize")
.short('s')
.action(ArgAction::SetTrue)
}
/// Represents the raw flag.
pub fn raw_flag() -> Arg {
Arg::new(ARG_RAW)
@@ -382,11 +369,6 @@ pub fn raw_flag() -> Arg {
.action(ArgAction::SetTrue)
}
/// Represents the sanitize flag parser.
pub fn parse_sanitize_flag(m: &ArgMatches) -> bool {
m.get_flag(ARG_SANITIZE)
}
/// Represents the raw flag parser.
pub fn parse_raw_flag(m: &ArgMatches) -> bool {
m.get_flag(ARG_RAW)
-2
View File
@@ -216,9 +216,7 @@ pub fn read<P: Printer>(
backend: &mut dyn Backend,
folder: &str,
ids: Vec<&str>,
// TODO: map this to ShowTextsStrategy
text_mime: &str,
_sanitize: bool,
raw: bool,
headers: Vec<&str>,
) -> Result<()> {
+1 -2
View File
@@ -283,7 +283,7 @@ fn main() -> Result<()> {
ids,
);
}
Some(email::args::Cmd::Read(ids, text_mime, sanitize, raw, headers)) => {
Some(email::args::Cmd::Read(ids, text_mime, raw, headers)) => {
let folder = account_config.folder_alias(folder.unwrap_or(DEFAULT_INBOX_FOLDER))?;
let mut backend = BackendBuilder::new()
.disable_cache(disable_cache)
@@ -297,7 +297,6 @@ fn main() -> Result<()> {
&folder,
ids,
text_mime,
sanitize,
raw,
headers,
);