remove unused stuff
This commit is contained in:
parent
76d4e91c00
commit
13f8888261
1 changed files with 3 additions and 17 deletions
|
@ -1,6 +1,5 @@
|
|||
import birl.{type Time}
|
||||
import gleam/dict.{type Dict}
|
||||
// import gleam/io
|
||||
import gleam/iterator.{type Iterator}
|
||||
import gleam/list
|
||||
import gleam/pair
|
||||
|
@ -9,6 +8,8 @@ import gleam/result
|
|||
import gleam/string
|
||||
import simplifile
|
||||
|
||||
// import gleam/io
|
||||
|
||||
pub type MBox {
|
||||
MBox(headers: Dict(String, String), body: String)
|
||||
InvalidMBox
|
||||
|
@ -39,20 +40,13 @@ pub fn parse_mbox(mboxcontents: String) -> MBox {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn get_headers(mbox: MBox) -> Result(Dict(String, String), Nil) {
|
||||
fn get_headers(mbox: MBox) -> Result(Dict(String, String), Nil) {
|
||||
case mbox {
|
||||
InvalidMBox -> Error(Nil)
|
||||
MBox(headers, _) -> Ok(headers)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn get_header(mbox: MBox, key: String) -> Result(String, Nil) {
|
||||
case mbox {
|
||||
MBox(headers, _) -> headers |> dict.get(key)
|
||||
InvalidMBox -> Error(Nil)
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_body(mboxcontents: String) -> Result(String, Nil) {
|
||||
// split headers from body
|
||||
case string.split_once(mboxcontents, "\n\n") {
|
||||
|
@ -102,14 +96,6 @@ fn remove_dead_space(acc: String, matched_content: String) -> String {
|
|||
|> string.replace(acc, matched_content, _)
|
||||
}
|
||||
|
||||
pub fn maildir_iterator(mbox_path: String) -> Iterator(String) {
|
||||
mbox_path
|
||||
|> simplifile.get_files
|
||||
|> result.lazy_unwrap(list.new)
|
||||
|> iterator.from_list
|
||||
|> iterator.map(read_file)
|
||||
}
|
||||
|
||||
// TODO: better error
|
||||
pub fn maildir_iterate(maildir_path: String) -> Iterator(#(String, String)) {
|
||||
case simplifile.get_files(maildir_path) {
|
||||
|
|
Loading…
Reference in a new issue