diff --git a/Cargo.toml b/Cargo.toml index 2be213b..e3a479d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -21,9 +21,6 @@ tar = "0.4.33" xz2 = "0.1.6" zip = "0.5.11" -# Dependency from workspace -oof = { path = "./oof" } - [dev-dependencies] tempdir = "0.3.7" rand = { version = "0.8.3", default-features = false, features = ["small_rng", "std"] } @@ -32,9 +29,3 @@ rand = { version = "0.8.3", default-features = false, features = ["small_rng", " lto = true codegen-units = 1 opt-level = 3 - -[workspace] -members = [ - ".", - "oof", -] diff --git a/oof/Cargo.toml b/oof/Cargo.toml deleted file mode 100644 index c134bc3..0000000 --- a/oof/Cargo.toml +++ /dev/null @@ -1,9 +0,0 @@ -[package] -name = "oof" -version = "0.1.0" -authors = ["João M. Bezerra "] -edition = "2018" -description = "Ouch's argparsing library" -repository = "https://github.com/vrmiguel/ouch" - -[dependencies] diff --git a/src/cli.rs b/src/cli.rs index b79d588..05d8a4a 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -5,9 +5,10 @@ use std::{ vec::Vec, }; -use oof::{arg_flag, flag}; use strsim::normalized_damerau_levenshtein; +use crate::{arg_flag, flag, oof}; + #[derive(PartialEq, Eq, Debug)] pub enum Command { /// Files to be compressed diff --git a/src/commands.rs b/src/commands.rs index ee36c60..b39ac7c 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -19,7 +19,7 @@ use crate::{ dialogs::Confirmation, extension::{CompressionFormat, Extension}, file::File, - utils, + oof, utils, }; pub fn run(command: Command, flags: &oof::Flags) -> crate::Result<()> { diff --git a/src/decompressors/decompressor.rs b/src/decompressors/decompressor.rs index d14bd69..f62bb23 100644 --- a/src/decompressors/decompressor.rs +++ b/src/decompressors/decompressor.rs @@ -1,6 +1,6 @@ use std::path::PathBuf; -use crate::file::File; +use crate::{file::File, oof}; pub enum DecompressionResult { FilesUnpacked(Vec), diff --git a/src/decompressors/tar.rs b/src/decompressors/tar.rs index fe2cff7..5298f82 100644 --- a/src/decompressors/tar.rs +++ b/src/decompressors/tar.rs @@ -8,7 +8,7 @@ use tar::{self, Archive}; use utils::colors; use super::decompressor::{DecompressionResult, Decompressor}; -use crate::{dialogs::Confirmation, file::File, utils}; +use crate::{dialogs::Confirmation, file::File, oof, utils}; #[derive(Debug)] pub struct TarDecompressor; diff --git a/src/decompressors/to_memory.rs b/src/decompressors/to_memory.rs index 50105a5..9ee4083 100644 --- a/src/decompressors/to_memory.rs +++ b/src/decompressors/to_memory.rs @@ -6,7 +6,7 @@ use std::{ use utils::colors; use super::decompressor::{DecompressionResult, Decompressor}; -use crate::{extension::CompressionFormat, file::File, utils}; +use crate::{extension::CompressionFormat, file::File, oof, utils}; struct DecompressorToMemory; pub struct GzipDecompressor; diff --git a/src/decompressors/zip.rs b/src/decompressors/zip.rs index d31115c..d9db14c 100644 --- a/src/decompressors/zip.rs +++ b/src/decompressors/zip.rs @@ -8,7 +8,7 @@ use utils::colors; use zip::{self, read::ZipFile, ZipArchive}; use super::decompressor::{DecompressionResult, Decompressor}; -use crate::{dialogs::Confirmation, file::File, utils}; +use crate::{dialogs::Confirmation, file::File, oof, utils}; #[cfg(unix)] fn __unix_set_permissions(file_path: &Path, file: &ZipFile) { diff --git a/src/error.rs b/src/error.rs index a64ff91..ab0d97e 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,6 +1,6 @@ use std::{fmt, path::PathBuf}; -use crate::utils::colors; +use crate::{oof, utils::colors}; pub enum Error { UnknownExtensionError(String), diff --git a/src/lib.rs b/src/lib.rs index c227598..bd0f46a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,7 @@ // Public modules pub mod cli; pub mod commands; +pub mod oof; // Private modules mod compressors; diff --git a/oof/src/error.rs b/src/oof/error.rs similarity index 99% rename from oof/src/error.rs rename to src/oof/error.rs index 3da0415..a5c1161 100644 --- a/oof/src/error.rs +++ b/src/oof/error.rs @@ -1,6 +1,6 @@ use std::{error, ffi::OsString, fmt}; -use crate::Flag; +use super::Flag; #[derive(Debug)] pub enum OofError { diff --git a/oof/src/flags.rs b/src/oof/flags.rs similarity index 100% rename from oof/src/flags.rs rename to src/oof/flags.rs diff --git a/oof/src/lib.rs b/src/oof/mod.rs similarity index 99% rename from oof/src/lib.rs rename to src/oof/mod.rs index 9505fe5..cbf3346 100644 --- a/oof/src/lib.rs +++ b/src/oof/mod.rs @@ -217,7 +217,7 @@ where mod tests { use std::os::unix::prelude::OsStringExt; - use crate::*; + use super::*; fn gen_args(text: &str) -> Vec { let args = text.split_whitespace(); diff --git a/oof/src/util.rs b/src/oof/util.rs similarity index 100% rename from oof/src/util.rs rename to src/oof/util.rs diff --git a/src/utils.rs b/src/utils.rs index d989543..fb9a53f 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -5,7 +5,7 @@ use std::{ path::{Path, PathBuf}, }; -use crate::{dialogs::Confirmation, extension::CompressionFormat, file::File}; +use crate::{dialogs::Confirmation, extension::CompressionFormat, file::File, oof}; #[macro_export] #[cfg(debug_assertions)] diff --git a/tests/compress_and_decompress.rs b/tests/compress_and_decompress.rs index 98ab149..61f84a3 100644 --- a/tests/compress_and_decompress.rs +++ b/tests/compress_and_decompress.rs @@ -4,7 +4,7 @@ use std::{ path::{Path, PathBuf}, }; -use ouch::{cli::Command, commands::run}; +use ouch::{cli::Command, commands::run, oof}; use rand::{rngs::SmallRng, RngCore, SeedableRng}; use tempdir::TempDir;