From 903ed734af9df8b5ae75524f0f8e98858ea8227f Mon Sep 17 00:00:00 2001 From: Christopher Sardegna Date: Tue, 28 Nov 2023 12:53:30 -0800 Subject: [PATCH] Move export type module --- imessage-database/src/util/mod.rs | 1 - .../src/app}/export_type.rs | 2 +- imessage-exporter/src/app/mod.rs | 3 ++- imessage-exporter/src/app/options.rs | 16 ++++++++++------ imessage-exporter/src/app/runtime.rs | 4 ++-- 5 files changed, 15 insertions(+), 11 deletions(-) rename {imessage-database/src/util => imessage-exporter/src/app}/export_type.rs (97%) diff --git a/imessage-database/src/util/mod.rs b/imessage-database/src/util/mod.rs index 7ae1e910..77c391bf 100644 --- a/imessage-database/src/util/mod.rs +++ b/imessage-database/src/util/mod.rs @@ -4,7 +4,6 @@ pub mod dates; pub mod dirs; -pub mod export_type; pub mod output; pub mod platform; pub mod plist; diff --git a/imessage-database/src/util/export_type.rs b/imessage-exporter/src/app/export_type.rs similarity index 97% rename from imessage-database/src/util/export_type.rs rename to imessage-exporter/src/app/export_type.rs index ffeb72fa..b0fd962d 100644 --- a/imessage-database/src/util/export_type.rs +++ b/imessage-exporter/src/app/export_type.rs @@ -35,7 +35,7 @@ impl Display for ExportType { #[cfg(test)] mod tests { - use crate::util::export_type::ExportType; + use crate::app::export_type::ExportType; #[test] fn can_parse_html_any_case() { diff --git a/imessage-exporter/src/app/mod.rs b/imessage-exporter/src/app/mod.rs index f04fe3d5..7ea00e10 100644 --- a/imessage-exporter/src/app/mod.rs +++ b/imessage-exporter/src/app/mod.rs @@ -1,6 +1,7 @@ -pub mod converter; pub mod attachment_manager; +pub mod converter; pub mod error; +pub mod export_type; pub mod options; pub mod progress; pub mod runtime; diff --git a/imessage-exporter/src/app/options.rs b/imessage-exporter/src/app/options.rs index f913a459..68a1428c 100644 --- a/imessage-exporter/src/app/options.rs +++ b/imessage-exporter/src/app/options.rs @@ -6,13 +6,14 @@ use imessage_database::{ tables::{attachment::DEFAULT_ATTACHMENT_ROOT, table::DEFAULT_PATH_IOS}, util::{ dirs::{default_db_path, home}, - export_type::ExportType, platform::Platform, query_context::QueryContext, }, }; -use crate::app::{attachment_manager::AttachmentManager, error::RuntimeError}; +use crate::app::{ + attachment_manager::AttachmentManager, error::RuntimeError, export_type::ExportType, +}; /// Default export directory name pub const DEFAULT_OUTPUT_DIR: &str = "imessage_export"; @@ -389,12 +390,12 @@ pub fn from_command_line() -> ArgMatches { #[cfg(test)] mod arg_tests { use imessage_database::util::{ - dirs::default_db_path, export_type::ExportType, platform::Platform, - query_context::QueryContext, + dirs::default_db_path, platform::Platform, query_context::QueryContext, }; use crate::app::{ attachment_manager::AttachmentManager, + export_type::ExportType, options::{get_command, validate_path, Options}, }; @@ -646,8 +647,11 @@ mod path_tests { use std::io::Write; use std::path::PathBuf; - use crate::app::options::{validate_path, DEFAULT_OUTPUT_DIR}; - use imessage_database::util::{dirs::home, export_type::ExportType}; + use crate::app::{ + export_type::ExportType, + options::{validate_path, DEFAULT_OUTPUT_DIR}, + }; + use imessage_database::util::dirs::home; #[test] fn can_validate_empty() { diff --git a/imessage-exporter/src/app/runtime.rs b/imessage-exporter/src/app/runtime.rs index d6e687fd..d214e67d 100644 --- a/imessage-exporter/src/app/runtime.rs +++ b/imessage-exporter/src/app/runtime.rs @@ -11,7 +11,7 @@ use rusqlite::Connection; use crate::{ app::{ attachment_manager::AttachmentManager, converter::Converter, error::RuntimeError, - options::Options, sanitizers::sanitize_filename, + export_type::ExportType, options::Options, sanitizers::sanitize_filename, }, Exporter, HTML, TXT, }; @@ -29,7 +29,7 @@ use imessage_database::{ MAX_LENGTH, ME, ORPHANED, UNKNOWN, }, }, - util::{dates::get_offset, export_type::ExportType, size::format_file_size}, + util::{dates::get_offset, size::format_file_size}, }; /// Stores the application state and handles application lifecycle