Skip to content

Commit

Permalink
Turning oof subcrate into a module
Browse files Browse the repository at this point in the history
  • Loading branch information
marcospb19 committed May 27, 2021
1 parent 5a2028b commit 57a3d23
Show file tree
Hide file tree
Showing 16 changed files with 13 additions and 29 deletions.
9 changes: 0 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"] }
Expand All @@ -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",
]
9 changes: 0 additions & 9 deletions oof/Cargo.toml

This file was deleted.

3 changes: 2 additions & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<()> {
Expand Down
2 changes: 1 addition & 1 deletion src/decompressors/decompressor.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::path::PathBuf;

use crate::file::File;
use crate::{file::File, oof};

pub enum DecompressionResult {
FilesUnpacked(Vec<PathBuf>),
Expand Down
2 changes: 1 addition & 1 deletion src/decompressors/tar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/decompressors/to_memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/decompressors/zip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{fmt, path::PathBuf};

use crate::utils::colors;
use crate::{oof, utils::colors};

pub enum Error {
UnknownExtensionError(String),
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Public modules
pub mod cli;
pub mod commands;
pub mod oof;

// Private modules
mod compressors;
Expand Down
2 changes: 1 addition & 1 deletion oof/src/error.rs → src/oof/error.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{error, ffi::OsString, fmt};

use crate::Flag;
use super::Flag;

#[derive(Debug)]
pub enum OofError {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion oof/src/lib.rs → src/oof/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ where
mod tests {
use std::os::unix::prelude::OsStringExt;

use crate::*;
use super::*;

fn gen_args(text: &str) -> Vec<OsString> {
let args = text.split_whitespace();
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
2 changes: 1 addition & 1 deletion tests/compress_and_decompress.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 57a3d23

Please sign in to comment.